ci: add required Azure config for pullfrog 0.1.58+ #7
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
| # 🐸 Comment on issues auto-closed by a merged PR | |
| # | |
| # GitHub closes an issue the moment a PR that says `Closes #123` merges — but with | |
| # bumpy the fix isn't *released* yet, just merged to main. To a watcher, "closed" | |
| # reads as "shipped", which is misleading. This drops a clarifying comment so they | |
| # know the change lands in the next release. | |
| # | |
| # Runs on `pull_request_target` to get an issues:write token, but it NEVER checks out | |
| # or runs any PR code — it only asks GitHub which issues the PR closed and posts a | |
| # comment. The workflow file itself always comes from the base branch (main), so a | |
| # fork PR can't alter it, and no untrusted string is interpolated into a shell command. | |
| # | |
| # Toggle: this feature is on simply because this file exists. Delete it to turn off. | |
| name: Merge Issue Note | |
| on: | |
| pull_request_target: | |
| types: [closed] | |
| branches: [main] # base branch — stable channel only (a `next` merge is a prerelease) | |
| permissions: | |
| issues: write | |
| jobs: | |
| note: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Comment on auto-closed issues | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| REPO: ${{ github.repository }} | |
| PR: ${{ github.event.pull_request.number }} | |
| run: | | |
| set -euo pipefail | |
| # Ask GitHub which issues this PR closes. closingIssuesReferences resolves | |
| # every Closes/Fixes/Resolves variant for us — no brittle body parsing. | |
| issues=$(gh api graphql \ | |
| -f query=' | |
| query($owner: String!, $repo: String!, $pr: Int!) { | |
| repository(owner: $owner, name: $repo) { | |
| pullRequest(number: $pr) { | |
| closingIssuesReferences(first: 50) { nodes { number } } | |
| } | |
| } | |
| }' \ | |
| -f owner="${REPO%/*}" \ | |
| -f repo="${REPO#*/}" \ | |
| -F pr="$PR" \ | |
| --jq '.data.repository.pullRequest.closingIssuesReferences.nodes[].number') | |
| if [ -z "$issues" ]; then | |
| echo "PR #$PR closed no linked issues — nothing to do." | |
| exit 0 | |
| fi | |
| for n in $issues; do | |
| echo "Commenting on issue #$n" | |
| gh issue comment "$n" --repo "$REPO" --body \ | |
| "✅ A fix has been merged to \`main\` in #${PR} and will ship in the next release. | |
| GitHub auto-closed this issue on merge, but the change isn't published yet — it'll go out with the next \`bumpy\` release. 🐸" | |
| done |