PureXML/third_party/rules-swift/.github/workflows/labeler.yml
Mihaela Mihaljevic c7ef8abfd9 chore(rules): pin rules-swift corpus, add gates and CI; drop redundant docs/rules mirror
Adopt the rules-swift pin-and-codify strategy in snapshot mode (third_party/rules-swift
@97dc70f + sha256), add codified gates, a conformance audit ledger, and
.github/workflows/rules-swift.yml (corpus-pin integrity required, full gate report mode).
Remove the docs/rules mirror it supersedes (repo-specific files kept under docs/). Style
and leak gates exclude the vendored corpus.
2026-06-30 14:02:40 +02:00

30 lines
1.3 KiB
YAML

name: issue-priority-labeler
# git-discipline.md Rule 1.6 "Forms gotcha": dropdown selections are TEXT in the body,
# they do not auto-apply as labels. This translates the Priority dropdown into the
# `priority: high` label when, and only when, the chosen value is "high".
on:
issues:
types: [opened, edited]
permissions:
issues: write
jobs:
apply-priority-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const body = context.payload.issue.body || "";
// The form renders the dropdown under a "### Priority" heading; read the next non-empty line.
const m = body.match(/^###\s+Priority\s*$\n+([^\n]+)/m);
const value = m ? m[1].trim().toLowerCase() : "";
const label = "priority: high";
const has = (context.payload.issue.labels || []).some(l => l.name === label);
const owner = context.repo.owner, repo = context.repo.repo;
const issue_number = context.payload.issue.number;
if (value === "high" && !has) {
await github.rest.issues.addLabels({ owner, repo, issue_number, labels: [label] });
} else if (value !== "high" && has) {
await github.rest.issues.removeLabel({ owner, repo, issue_number, name: label }).catch(() => {});
}