PureYAML/.github/workflows/labeler.yml
Mihaela M 9acfd57acc chore(issues): add required complexity field and a form labeler
Add the Complexity dropdown that Rule 1.6 requires on both issue forms
(status date, priority, complexity), alongside the existing per-kind
fields. Add a labeler workflow that maps the Priority dropdown to the
priority: high label on issue open and edit, closing the Rule 1.6
gotcha where form dropdowns produce body text but never apply a label.
Complexity stays a body field only, never a label, per Rule 2.1.
2026-06-26 05:48:01 +02:00

40 lines
1.2 KiB
YAML

name: Issue labeler
# Rule 1.6 backstop: issue-form dropdown selections produce body TEXT under
# `### <field>` headings, not labels. This translates the Priority dropdown into
# the `priority: high` label. Complexity is intentionally a body field only, not
# a label (Rule 2.1), so it is not mapped here.
on:
issues:
types: [opened, edited]
permissions:
issues: write
jobs:
label:
name: Apply form labels
runs-on: ubuntu-latest
steps:
- name: Apply priority label from the issue form
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: ${{ github.event.issue.body }}
run: |
# Print the first non-empty line after a "### <heading>" line.
value_under() {
printf '%s\n' "$BODY" | awk -v h="### $1" '
$0 == h { found = 1; next }
found && NF { print; exit }
'
}
priority=$(value_under "Priority")
if [ "$priority" = "High" ]; then
gh issue edit "$NUMBER" --repo "$REPO" --add-label "priority: high"
else
gh issue edit "$NUMBER" --repo "$REPO" --remove-label "priority: high" || true
fi