Assume label is already there #15
Workflow file for this run
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
name: Compatibility Check | |
on: | |
pull_request: | |
jobs: | |
compatible: | |
name: Is change incompatible | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@v4 | |
- name: Run script | |
id: check_incompatibility | |
run: | | |
cd .github/compatibility | |
npm ci | |
npm run check | |
- name: Add label PR on failure | |
if: failure() && steps.check_incompatibility.outcome == 'failure' # Only runs if your script failed. | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['incompatible-changes'] | |
}) | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
- name: Remove label PR on success | |
if: steps.check_incompatibility.outcome == 'success' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.removeLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
name: 'incompatible-changes' | |
}).then(() => { | |
console.log('Label removed successfully!'); | |
}).catch((error) => { | |
console.error('An error occurred while removing the label:', error); | |
}) | |
github-token: ${{secrets.GITHUB_TOKEN}} | |