fix: Return an error if the context is nil #6
Workflow file for this run
This file contains hidden or 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: PR / Label | |
on: | |
pull_request_target: { } | |
jobs: | |
triage: | |
name: Triage | |
permissions: | |
contents: read | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Apply commit message labels | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const labels = [] | |
if (context.payload.pull_request.title.startsWith('fix:')) { | |
labels.push('bug 🐛') | |
} | |
if (context.payload.pull_request.title.startsWith('chore:')) { | |
labels.push('chore 🧹') | |
} | |
if (context.payload.pull_request.title.startsWith('feat:')) { | |
labels.push('feature 💡') | |
} | |
if (labels.length > 0) { | |
github.rest.issues.addLabels({ | |
issue_number: context.issue.number, | |
labels, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}) | |
} |