Skip to content

feat(ci): auto-apply triage label on PR open#13

Open
NORSAIN-AI wants to merge 1 commit intomainfrom
feat/auto-triage-labels
Open

feat(ci): auto-apply triage label on PR open#13
NORSAIN-AI wants to merge 1 commit intomainfrom
feat/auto-triage-labels

Conversation

@NORSAIN-AI
Copy link
Copy Markdown
Owner

Summary

  • Adds .github/workflows/auto-label-triage.yml — on pull_request: opened, applies the triage label via actions/github-script@v7. Permissions scoped to pull-requests: write + issues: write.
  • Prepends triage to the allowed labels list in .github/workflows/require-labels.yml so auto-applied triage satisfies the gate.
  • triage label provisioned in the repo (color fbca04, "Needs triage").

Prevents the blocker seen on #12, where a PR opened without labels stalled the require-labels check until a human intervened. New PRs now pass the gate on open; authors can still refine labels afterwards.

Verification

Test plan

  • actionlint passes on the new workflow
  • yamllint clean (no new violations)
  • This PR itself passes require-labels (labels ci-cd, enhancement applied)
  • On merge, next PR opened in this repo receives triage automatically

Adds .github/workflows/auto-label-triage.yml to auto-label new PRs with
'triage' via actions/github-script@v7. Prepends 'triage' to the
require-labels allowed list so the label gate passes deterministically
on PR open. Prevents the blocker seen on PR #12 where a PR with no
labels stalled the required-labels check.
Copilot AI review requested due to automatic review settings April 22, 2026 14:35
@github-actions github-actions Bot added the triage Needs triage label Apr 22, 2026
@github-actions
Copy link
Copy Markdown

⚠️ This PR must have a milestone assigned before it can be merged/closed. Please assign an appropriate milestone.

@NORSAIN-AI NORSAIN-AI added ci-cd CI/CD and automation changes enhancement New feature or request labels Apr 22, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Formålet med PR-en er å redusere friksjon ved opprettelse av PR-er ved automatisk å legge på en triage-label slik at require-labels-sjekken ikke blokkerer før et menneske rekker å merke PR-en.

Changes:

  • Ny workflow som forsøker å auto-labele nye PR-er med triage ved åpning.
  • Oppdatert require-labels til å akseptere triage som gyldig label.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/auto-label-triage.yml Legger til workflow som auto-appliserer triage-label på PR open.
.github/workflows/require-labels.yml Oppdaterer whitelist for labels slik at triage-label kan tilfredsstille label-gate.

Comment on lines +20 to +25
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['triage']
});
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Workflow uses the label name triage, but this repo’s label taxonomy file defines status:triage (see labels.yml:64-66). If label sync is used, triage may not exist and the API call will fail. Consider switching to status:triage (and keeping naming consistent with other status:* labels).

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +7 to +10
permissions:
pull-requests: write
issues: write

Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull-requests: write doesn’t appear to be needed here: the script calls github.rest.issues.addLabels, which only requires issues: write. To follow least-privilege, drop the extra scope (or scope permissions at the job level).

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +14 to +25
runs-on: ubuntu-latest
steps:
- name: Add triage label to new PR
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['triage']
});
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On PRs from forks, the GITHUB_TOKEN for pull_request events is typically read-only, so issues.addLabels can fail with 403 and make the workflow red. Add an explicit guard (e.g., skip when github.event.pull_request.head.repo.fork is true) and/or handle 403 as a non-fatal outcome to avoid noisy failures.

Copilot uses AI. Check for mistakes.
mode: minimum
count: 1
labels: "bug, enhancement, documentation, dependencies, ci-cd, security, configuration, testing, wontfix, duplicate, invalid, question"
labels: "triage, bug, enhancement, documentation, dependencies, ci-cd, security, configuration, testing, wontfix, duplicate, invalid, question"
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triage was added to the allowed-label list, but the repo’s label taxonomy defines status:triage (see labels.yml:64-66). If the intent is to use the standardized label set, rename this entry to status:triage (and keep auto-label-triage.yml consistent) to avoid the required-labels check accepting a label that may not exist.

Copilot generated this review using guidance from repository custom instructions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-cd CI/CD and automation changes enhancement New feature or request needs-milestone triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants