Add CI job to report main branch build failures via GitHub issues
What changed, and why it matters
This commit adds a GitHub Actions automation that opens or comments on an issue when the project's main branch CI build fails. It does not change any wallet, networking, or cryptographic code. There is no direct security vulnerability in the change itself.
No security action required. Review as normal CI/infrastructure change. Optionally verify the `issues: write` permission is the minimum required and that the `gh` CLI commands handle edge cases (empty committer, missing label) gracefully.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch appends a new notify-failure job to .github/workflows/build.yml. It runs only when any required CI job fails on the main branch, uses the built-in secrets.GITHUB_TOKEN with issues: write permission, and calls the gh CLI to create/comment on an issue and optionally assign it to the commit author. The workflow uses standard GitHub context variables and does not introduce new secrets, third-party actions, or code execution paths beyond GitHub’s native issue-management API.
Changed components
.github/workflows/build.ymlInspect captured patch +47 / −0
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c0593d4..0fbc9ed 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -342,3 +342,50 @@ jobs:
- name: Test tor connections using lightning-net-tokio
run: |
TOR_PROXY="127.0.0.1:9050" RUSTFLAGS="--cfg=tor" cargo test --verbose --color always -p lightning-net-tokio
+
+ notify-failure:
+ needs: [build, fuzz, linting, rustfmt, check_release, check_docs, benchmark, ext-test, tor-connect, coverage]
+ if: failure() && github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ permissions:
+ issues: write
+ steps:
+ - name: Create or update failure issue
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ LABEL="build failed"
+ TITLE="Failed build: ${{ github.workflow }}"
+ RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
+ REPO_URL="https://github.com/${{ github.repository }}"
+ COMMITTER="${{ github.event.head_commit.author.username }}"
+ BODY="GitHub Actions workflow [${{ github.workflow }} #${{ github.run_number }}](${RUN_URL}) failed."
+ BODY="${BODY}"$'\n\n'"Event: ${{ github.event_name }}"
+ BRANCH="${{ github.ref_name }}"
+ BODY="${BODY}"$'\n'"Branch: [${BRANCH}](${REPO_URL}/tree/${BRANCH})"
+ BODY="${BODY}"$'\n'"Commit: [${{ github.sha }}](${REPO_URL}/commit/${{ github.sha }})"
+ if [ -n "$COMMITTER" ]; then
+ BODY="${BODY}"$'\n'"Committer: @${COMMITTER}"
+ fi
+
+ # Ensure label exists
+ if ! gh label list --search "$LABEL" --json name --jq '.[].name' | grep -qxF "$LABEL"; then
+ gh label create "$LABEL"
+ fi
+
+ # Find existing open issue with this label
+ ISSUE_NUMBER=$(gh issue list --label "$LABEL" --state open --json number --jq '.[0].number // empty')
+
+ if [ -n "$ISSUE_NUMBER" ]; then
+ gh issue comment "$ISSUE_NUMBER" --body "$BODY"
+ else
+ ISSUE_URL=$(gh issue create --title "$TITLE" --label "$LABEL" --body "$BODY")
+ ISSUE_NUMBER=$(echo "$ISSUE_URL" | grep -o '[0-9]*$')
+ fi
+
+ # Assign issue to committer if no one is assigned yet
+ ASSIGNEE_COUNT=$(gh issue view "$ISSUE_NUMBER" --json assignees --jq '.assignees | length')
+ if [ "$ASSIGNEE_COUNT" = "0" ] && [ -n "$COMMITTER" ]; then
+ gh issue edit "$ISSUE_NUMBER" --add-assignee "$COMMITTER" || true
+ fi
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.