Skip to content

Commit

Permalink
fix(ci): unlabel job should not fail (#5670)
Browse files Browse the repository at this point in the history
- new github-script versions move issues client to rest.issues
- add try-catch block, ignore remove label error

Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
  • Loading branch information
diafour committed May 29, 2023
1 parent 630725e commit 3f4267a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/test_main.yml
Expand Up @@ -28,12 +28,24 @@ jobs:
- uses: actions/github-script@v6
with:
script: >
github.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: '${{ github.event.label.name }}'
})
core.startGroup(`Remove label '${context.payload.label.name}' from issue ${context.issue.number} ...`);
try {
const response = await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: context.payload.label.name
});
if (response.status !== 204 || response.status !== 200) {
core.info(`Bad response on remove label: ${JSON.stringify(response)}`)
} else {
core.info(`Removed.`);
}
} catch (error) {
core.info(`Ignore error when removing label: may be it was removed by another workflow. Error: ${dumpError(error)}.`);
} finally {
core.endGroup()
}
integration_main:
if: |
Expand Down

0 comments on commit 3f4267a

Please sign in to comment.