.github/workflows/released_or_not.yml #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
issue_comment: | |
types: [created] | |
jobs: | |
not-released: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for /notreleased command | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const comment = context.payload.comment.body; | |
if (comment.startsWith('/notreleased ')) { | |
return 'not released'; | |
} else { | |
return null; | |
} | |
result-encoding: string | |
id: get-label | |
- uses: actions/github-script@v7 | |
if: steps.get-label.outputs.result != 'null' | |
with: | |
script: | | |
const label = '${{ steps.get-label.outputs.result }}'; | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: [label] | |
}) | |
released: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for /released command | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const comment = context.payload.comment.body; | |
if (comment.startsWith('/released ')) { | |
return 'released'; | |
} else { | |
return null; | |
} | |
result-encoding: string | |
id: released | |
- uses: actions/github-script@v7 | |
if: steps.released.outputs.result != 'null' | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
name: 'not released', | |
}); |