Compare commits

..

3 Commits

Author SHA1 Message Date
xrkffgg
f743eedacb chore: add catch (#59)
* chore: add catch

* format
2021-02-03 09:28:14 +08:00
xrkffgg
65461c17ed docs: update v2.1.1 (#58) 2021-02-03 00:45:14 +08:00
xrkffgg
1efbf3d3cf fix: api request limit (#57) 2021-02-03 00:34:17 +08:00
13 changed files with 200 additions and 186 deletions

View File

@@ -1,3 +1,9 @@
## v2.1.1
`2021.02.03`
- fix: api request limit. [#57](https://github.com/actions-cool/issues-helper/pull/57)
## v2.1.0 ## v2.1.0
`2021.02.02` `2021.02.02`

View File

@@ -149,7 +149,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -191,7 +191,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -216,7 +216,7 @@ Close the specified issue.
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -249,7 +249,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -293,7 +293,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -326,7 +326,7 @@ Create label。If you want to create multiple labels base on repository path. [S
```yml ```yml
- name: Create label - name: Create label
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-label' actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -354,7 +354,7 @@ According to [`comment-id`](#comment-id) delete the specified comment.
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -386,7 +386,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -420,7 +420,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -455,7 +455,7 @@ Open the specified issue.
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -476,7 +476,7 @@ Remove the person designated by issue.
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -499,7 +499,7 @@ Remove the specified labels.
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -524,7 +524,7 @@ Replace the labels of issue.
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -547,7 +547,7 @@ Unlock the specified issue.
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -580,7 +580,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -608,7 +608,7 @@ Update the specified issue according to the `issue-number`.
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -658,7 +658,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -701,7 +701,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -754,7 +754,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -793,7 +793,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -827,7 +827,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -875,7 +875,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -922,7 +922,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -965,7 +965,7 @@ jobs:
if: github.event.label.name == 'watch' if: github.event.label.name == 'watch'
steps: steps:
- name: find comments - name: find comments
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
id: fcid id: fcid
with: with:
actions: 'find-comments' actions: 'find-comments'
@@ -976,7 +976,7 @@ jobs:
- name: create comment - name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }} if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -985,7 +985,7 @@ jobs:
- name: update comment - name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }} if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -1017,7 +1017,7 @@ When the token is not filled in actions or the corresponding secrets are not add
```yml ```yml
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
id: createissue id: createissue
with: with:
actions: 'create-issue' actions: 'create-issue'

View File

@@ -149,7 +149,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -191,7 +191,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -216,7 +216,7 @@ jobs:
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -249,7 +249,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -293,7 +293,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -326,7 +326,7 @@ jobs:
```yml ```yml
- name: Create label - name: Create label
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-label' actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -354,7 +354,7 @@ jobs:
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -386,7 +386,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -420,7 +420,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -455,7 +455,7 @@ jobs:
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -476,7 +476,7 @@ jobs:
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -499,7 +499,7 @@ jobs:
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -524,7 +524,7 @@ jobs:
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -547,7 +547,7 @@ jobs:
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -580,7 +580,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -608,7 +608,7 @@ jobs:
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -656,7 +656,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -699,7 +699,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -748,7 +748,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -787,7 +787,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -821,7 +821,7 @@ jobs:
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -869,7 +869,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -916,7 +916,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -959,7 +959,7 @@ jobs:
if: github.event.label.name == 'watch' if: github.event.label.name == 'watch'
steps: steps:
- name: find comments - name: find comments
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
id: fcid id: fcid
with: with:
actions: 'find-comments' actions: 'find-comments'
@@ -970,7 +970,7 @@ jobs:
- name: create comment - name: create comment
if: ${{ steps.fcid.outputs.comments.length == 0 }} if: ${{ steps.fcid.outputs.comments.length == 0 }}
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -979,7 +979,7 @@ jobs:
- name: update comment - name: update comment
if: ${{ steps.fcid.outputs.comments.length == 1 }} if: ${{ steps.fcid.outputs.comments.length == 1 }}
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -1011,7 +1011,7 @@ jobs:
```yml ```yml
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
id: createissue id: createissue
with: with:
actions: 'create-issue' actions: 'create-issue'

86
dist/index.js vendored
View File

@@ -8005,7 +8005,7 @@ async function doCreateLabel(owner, repo) {
}); });
core.info(`Actions: [create-label][${name}] success!`); core.info(`Actions: [create-label][${name}] success!`);
} catch (err) { } catch (err) {
console.log(err.message) console.log(err.message);
} }
} }
@@ -8053,17 +8053,6 @@ async function doMarkDuplicate(owner, repo, labels) {
const ifCommandInput = !!duplicateCommand; const ifCommandInput = !!duplicateCommand;
const res = await octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
if ( if (
!commentBody.includes('?') && !commentBody.includes('?') &&
((ifCommandInput && ((ifCommandInput &&
@@ -8071,37 +8060,52 @@ async function doMarkDuplicate(owner, repo, labels) {
commentBody.split(' ')[0] == duplicateCommand) || commentBody.split(' ')[0] == duplicateCommand) ||
testDuplicate(commentBody)) testDuplicate(commentBody))
) { ) {
if (ifCommandInput) { try {
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); const res = await octokit.repos.getCollaboratorPermissionLevel({
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); owner,
} else if (contents) { repo,
await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents)); username: commentUser,
} });
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
const issue = await octokit.issues.get({ if (ifCommandInput) {
owner, const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
repo, await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
issue_number: issueNumber, } else if (contents) {
}); await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
let newLabels = []; }
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') { const issue = await octokit.issues.get({
await doCloseIssue(owner, repo, issueNumber); owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
}
} catch (error) {
core.info(error.message);
} }
} else { } else {
core.info( core.info(

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -73,7 +73,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -110,7 +110,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -142,7 +142,7 @@ Find the current warehouse issue No. 1, the creator is k and the content contain
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -188,7 +188,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -233,7 +233,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-inactive - name: check-inactive
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-inactive' actions: 'check-inactive'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: check-issue - name: check-issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'check-issue' actions: 'check-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: close-issues - name: close-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issues' actions: 'close-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -138,7 +138,7 @@ jobs:
```yml ```yml
- name: Find comments - name: Find comments
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'find-comments' actions: 'find-comments'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -184,7 +184,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: lock-issues - name: lock-issues
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issues' actions: 'lock-issues'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -229,7 +229,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: month-statistics - name: month-statistics
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'month-statistics' actions: 'month-statistics'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -62,7 +62,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -85,7 +85,7 @@ Close the specified issue.
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -116,7 +116,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -189,7 +189,7 @@ Create label。If you want to create multiple labels base on repository path. [S
```yml ```yml
- name: Create label - name: Create label
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-label' actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -215,7 +215,7 @@ According to [`comment-id`](/en-US/guide/ref#-comment-id) delete the specified c
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -245,7 +245,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -277,7 +277,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -316,7 +316,7 @@ Open the specified issue.
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -335,7 +335,7 @@ Remove the person designated by issue.
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -356,7 +356,7 @@ Remove the specified labels.
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -379,7 +379,7 @@ Replace the labels of issue.
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -400,7 +400,7 @@ Unlock the specified issue.
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -431,7 +431,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -457,7 +457,7 @@ Update the specified issue according to the `issue-number`.
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -505,7 +505,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Add assigness - name: Add assigness
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-assignees' actions: 'add-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -62,7 +62,7 @@ jobs:
if: contains(github.event.issue.body, 'xxx') == false if: contains(github.event.issue.body, 'xxx') == false
steps: steps:
- name: Add labels - name: Add labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'add-labels' actions: 'add-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -85,7 +85,7 @@ jobs:
```yml ```yml
- name: Close issue - name: Close issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'close-issue' actions: 'close-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -116,7 +116,7 @@ jobs:
if: github.event.label.name == 'xxx' if: github.event.label.name == 'xxx'
steps: steps:
- name: Create comment - name: Create comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create issue - name: Create issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-issue' actions: 'create-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -189,7 +189,7 @@ jobs:
```yml ```yml
- name: Create label - name: Create label
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-label' actions: 'create-label'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -215,7 +215,7 @@ jobs:
```yml ```yml
- name: Delete comment - name: Delete comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'delete-comment' actions: 'delete-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -245,7 +245,7 @@ jobs:
if: github.event.label.name == 'invalid' if: github.event.label.name == 'invalid'
steps: steps:
- name: Lock issue - name: Lock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'lock-issue' actions: 'lock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -277,7 +277,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: mark-duplicate - name: mark-duplicate
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'mark-duplicate' actions: 'mark-duplicate'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -316,7 +316,7 @@ jobs:
```yml ```yml
- name: Open issue - name: Open issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'open-issue' actions: 'open-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -335,7 +335,7 @@ jobs:
```yml ```yml
- name: Remove assignees - name: Remove assignees
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-assignees' actions: 'remove-assignees'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -356,7 +356,7 @@ jobs:
```yml ```yml
- name: Remove labels - name: Remove labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'remove-labels' actions: 'remove-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -379,7 +379,7 @@ jobs:
```yml ```yml
- name: Set labels - name: Set labels
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'set-labels' actions: 'set-labels'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -400,7 +400,7 @@ jobs:
```yml ```yml
- name: Unlock issue - name: Unlock issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'unlock-issue' actions: 'unlock-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -431,7 +431,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Update comment - name: Update comment
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-comment' actions: 'update-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -457,7 +457,7 @@ jobs:
```yml ```yml
- name: Update issue - name: Update issue
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'update-issue' actions: 'update-issue'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
@@ -504,7 +504,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: welcome - name: welcome
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'welcome' actions: 'welcome'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -38,7 +38,7 @@ jobs:
steps: steps:
- name: help wanted - name: help wanted
if: github.event.label.name == 'help wanted' if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -38,7 +38,7 @@ jobs:
steps: steps:
- name: help wanted - name: help wanted
if: github.event.label.name == 'help wanted' if: github.event.label.name == 'help wanted'
uses: actions-cool/issues-helper@v2.1.0 uses: actions-cool/issues-helper@v2.1.1
with: with:
actions: 'create-comment' actions: 'create-comment'
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,6 +1,6 @@
{ {
"name": "issues-helper", "name": "issues-helper",
"version": "2.0.0", "version": "2.1.1",
"private": true, "private": true,
"description": "Some operations on issue.", "description": "Some operations on issue.",
"main": "src/main.js", "main": "src/main.js",

View File

@@ -1,7 +1,7 @@
const { readFileSync, writeFileSync } = require('fs'); const { readFileSync, writeFileSync } = require('fs');
const last = /v2\.0\.0/g; const last = /v2\.1\.1/g;
const now = 'v2.1.0'; const now = 'v2.2.0';
let readme = readFileSync('./README.md', 'utf-8'); let readme = readFileSync('./README.md', 'utf-8');
readme = readme.replace(last, now); readme = readme.replace(last, now);

View File

@@ -190,17 +190,6 @@ async function doMarkDuplicate(owner, repo, labels) {
const ifCommandInput = !!duplicateCommand; const ifCommandInput = !!duplicateCommand;
const res = await octokit.repos.getCollaboratorPermissionLevel({
owner,
repo,
username: commentUser,
});
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
if ( if (
!commentBody.includes('?') && !commentBody.includes('?') &&
((ifCommandInput && ((ifCommandInput &&
@@ -208,37 +197,52 @@ async function doMarkDuplicate(owner, repo, labels) {
commentBody.split(' ')[0] == duplicateCommand) || commentBody.split(' ')[0] == duplicateCommand) ||
testDuplicate(commentBody)) testDuplicate(commentBody))
) { ) {
if (ifCommandInput) { try {
const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of'); const res = await octokit.repos.getCollaboratorPermissionLevel({
await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true); owner,
} else if (contents) { repo,
await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents)); username: commentUser,
} });
const { permission } = res.data;
if (!checkPermission(requirePermission, permission)) {
core.info(`The user ${commentUser} is not allow!`);
return false;
}
const issue = await octokit.issues.get({ if (ifCommandInput) {
owner, const nextBody = commentBody.replace(duplicateCommand, 'Duplicate of');
repo, await doUpdateComment(owner, repo, commentId, nextBody, 'replace', true);
issue_number: issueNumber, } else if (contents) {
}); await doCreateCommentContent(owner, repo, commentId, dealStringToArr(contents));
let newLabels = []; }
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') { const issue = await octokit.issues.get({
await doCloseIssue(owner, repo, issueNumber); owner,
repo,
issue_number: issueNumber,
});
let newLabels = [];
if (issue.data.labels.length > 0) {
newLabels = issue.data.labels
.map(({ name }) => name)
.filter(name => !dealStringToArr(removeLables).includes(name));
}
if (duplicateLabels) {
newLabels = [...newLabels, ...dealStringToArr(duplicateLabels)];
}
if (labels) {
newLabels = dealStringToArr(labels);
}
if (newLabels.length > 0) {
await doSetLabels(owner, repo, issueNumber, newLabels.toString());
core.info(`Actions: [mark-duplicate-labels][${newLabels}] success!`);
}
if (closeIssue == 'true') {
await doCloseIssue(owner, repo, issueNumber);
}
} catch (error) {
core.info(error.message);
} }
} else { } else {
core.info( core.info(