Modernize auto-label workflow: replace deprecated action, add error handling and more
Problems
The auto-label workflow uses an outdated, unmaintained action (satackey/action-js-inline)
that relies on Node.js 20, which GitHub has permanently unsupported. Additionally, the workflow has:
- No error handling
- A hardcoded commit hash (making updates difficult)
- Redundant variable extraction.
- No permission handling
Solution
- Update the .github/workflows/autolabel.yml to this modified version of the official 'actions/github-script':
name: Auto-Label
on:
issues:
types: [opened]
jobs:
label:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/github-script@v7
with:
script: |
try {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['unconfirmed']
});
} catch (error) {
core.setFailed(Failed to add label: ${error.message});
}
Note: The indents may fail to render in your browser so once copied you may have to fix the indents.
Source: ish-app/ish