Incompatible changes will lead to added labels and failing actions #46
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: Compability 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_incompability | |
run: | | |
cd minka-js | |
npm ci | |
npm run check | |
- name: Add label PR on failure | |
if: failure() && steps.check_incompability.outcome == 'failure' # Only runs if your script failed. | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'incompatible-changes', | |
color: 'FF0000' | |
}).catch(err => console.log(`Label already exists`)) | |
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_incompability.outcome == 'success' | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.createLabel({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'incompatible-changes', | |
color: 'FF0000' | |
}).catch(err => console.log(`Label already exists`)) | |
github.rest.issues.removeLabel({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: 'incompatible-changes' | |
}) | |
github-token: ${{secrets.GITHUB_TOKEN}} | |