Add ticket/issue/bug workflow to AGENTS.md #4
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: Changelog | |
| on: | |
| pull_request: | |
| branches: [master] | |
| types: [opened, synchronize, reopened, labeled, unlabeled, edited] | |
| jobs: | |
| changelog: | |
| name: Require CHANGELOG entry | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Skip if opted out | |
| id: optout | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} | |
| run: | | |
| if echo "$PR_TITLE" | grep -qiF '[no-changelog]'; then | |
| echo "Opt-out via PR title token [no-changelog]." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| if echo "$PR_LABELS" | grep -q '"skip-changelog"'; then | |
| echo "Opt-out via skip-changelog label." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| - name: Checkout PR | |
| if: steps.optout.outputs.skip == 'false' | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Check for CHANGELOG update | |
| if: steps.optout.outputs.skip == 'false' | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| set -euo pipefail | |
| changed=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA") | |
| echo "Changed files:" | |
| echo "$changed" | |
| echo | |
| user_visible=$(echo "$changed" | grep -E '^(internal/|cmd/|services/|README\.md$)' || true) | |
| if [ -z "$user_visible" ]; then | |
| echo "No user-visible files changed; CHANGELOG update not required." | |
| exit 0 | |
| fi | |
| if echo "$changed" | grep -qx 'CHANGELOG.md'; then | |
| echo "CHANGELOG.md was updated alongside user-visible changes." | |
| exit 0 | |
| fi | |
| cat <<'EOF' | |
| ::error::CHANGELOG.md was not updated, but this PR changes user-visible code (internal/, cmd/, services/, or README.md). | |
| Add a bullet under the "## [Unreleased]" section in CHANGELOG.md describing the user-visible effect. | |
| See AGENTS.md > "Changelog updates" for guidance. | |
| If this PR is genuinely not user-visible (test-only, refactor-only, CI-only), opt out by either: | |
| - adding the label skip-changelog | |
| - adding the token [no-changelog] to the PR title | |
| EOF | |
| exit 1 |