-
-
Notifications
You must be signed in to change notification settings - Fork 0
chore(ci): repoint push-email-notify to smtp-notify-action #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,19 +3,43 @@ | |||||
| # PUSH_EMAIL_ENABLED=true (the single on/off switch). Addresses are pre-filled; | ||||||
| # sending needs the org SMTP secrets (SMTP_HOST/PORT/USER/PASS). Inherited by | ||||||
| # new repos from the template; placed on existing repos by the farm sweep. | ||||||
| # | ||||||
| # Re-landed after the 2026-07-20 notification-storm freeze (removed in | ||||||
| # 09f94c5), now on hyperpolymath/smtp-notify-action: Node-free, the SMTP | ||||||
| # session is Idris2-specified and machine-checked, the binary is Zig-built, | ||||||
| # byte-reproducible, and SHA-256-pinned inside the action itself. | ||||||
| name: Push email notification | ||||||
| on: | ||||||
| push: {} | ||||||
| push: | ||||||
| # Branch pushes only: tag and deletion payloads mislabel Branch:/head_commit. | ||||||
| branches: ['**'] | ||||||
| concurrency: | ||||||
| # Deliberately per-RUN, so no run is ever queued behind another and none is | ||||||
| # ever cancelled. Do NOT "tidy" this into a shared group such as | ||||||
| # ${{ github.workflow }}-${{ github.ref }}. GitHub's workflow-syntax docs: | ||||||
| # "By default, any existing pending job or workflow in the same concurrency | ||||||
| # group will be canceled and the new queued job or workflow will take its | ||||||
| # place." That happens regardless of cancel-in-progress, which governs only | ||||||
| # the RUNNING job. On this workflow it silently loses a notification email, | ||||||
| # with no error anywhere. Every run here reports a DISTINCT commit, so there | ||||||
| # is no redundant work for a concurrency limit to remove. | ||||||
| # The docs also offer `queue: max` (up to 100 pending); not used, because 100 | ||||||
| # is still a cap whereas a per-run group needs none. | ||||||
| # Verified with zizmor 1.30.0: deleting this block raises concurrency-limits; | ||||||
| # this form silences it exactly as a shared group would. | ||||||
| group: push-email-${{ github.run_id }} | ||||||
| cancel-in-progress: false | ||||||
| permissions: | ||||||
| contents: read | ||||||
| jobs: | ||||||
| notify: | ||||||
| name: Email on push | ||||||
| if: ${{ vars.PUSH_EMAIL_ENABLED == 'true' }} | ||||||
| runs-on: ubuntu-latest | ||||||
| timeout-minutes: 5 | ||||||
| steps: | ||||||
| - name: Send push notification email | ||||||
| uses: dawidd6/action-send-mail@0bbdab096651ee93f37ec02383e088183d41ff0b # pinned | ||||||
| uses: hyperpolymath/smtp-notify-action@ede1191ef6ff3ac02c4f4d9efdf837ee517e11d7 # v0.2.0 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -u
printf '%s\n' '--- workflow ---'
sed -n '34,46p' .github/workflows/push-email-notify.yml
printf '%s\n' '--- action references in workflow ---'
rg -n 'hyperpolymath/smtp-notify-action@|v0\.[12]\.0' .github/workflows/push-email-notify.yml
printf '%s\n' '--- repository status ---'
git diff --stat -- .github/workflows/push-email-notify.yml
printf '%s\n' '--- GitHub tag resolution ---'
for tag in v0.1.0 v0.2.0; do
echo "tag=$tag"
curl -fsSL "https://api.github.com/repos/hyperpolymath/smtp-notify-action/git/ref/tags/$tag" |
jq -c '{ref, object}'
doneRepository: hyperpolymath/bofig Length of output: 1256 🤖 get_repo_knowledge executed:
Length of output: 6290 🏁 Script executed: #!/bin/bash
set -u
resolve_tag() {
tag="$1"
ref_json="$(curl -fsSL "https://api.github.com/repos/hyperpolymath/smtp-notify-action/git/ref/tags/$tag")"
object_sha="$(printf '%s' "$ref_json" | jq -r '.object.sha')"
object_type="$(printf '%s' "$ref_json" | jq -r '.object.type')"
if [ "$object_type" = tag ]; then
target_json="$(curl -fsSL "https://api.github.com/repos/hyperpolymath/smtp-notify-action/git/tags/$object_sha")"
target_sha="$(printf '%s' "$target_json" | jq -r '.object.sha')"
target_type="$(printf '%s' "$target_json" | jq -r '.object.type')"
else
target_sha="$object_sha"
target_type="$object_type"
fi
printf '%s\n' "$tag"
printf ' tag_object=%s\n target_type=%s\n target_commit=%s\n' "$object_sha" "$target_type" "$target_sha"
curl -fsSL "https://api.github.com/repos/hyperpolymath/smtp-notify-action/commits/$target_sha" |
jq -r '" commit_api_sha="+.sha'
}
resolve_tag v0.1.0
resolve_tag v0.2.0
for sha in \
1b3b752d39a4fe4c0f28f10905e4608789d3e050 \
ede1191ef6ff3ac02c4f4d9efdf837ee517e11d7; do
printf 'pin=%s\n' "$sha"
curl -fsSL "https://api.github.com/repos/hyperpolymath/smtp-notify-action/commits/$sha" |
jq -r '" commit_api_sha="+.sha'
doneRepository: hyperpolymath/bofig Length of output: 757 Pin the action to the approved revision. The workflow uses Proposed correction- uses: hyperpolymath/smtp-notify-action@ede1191ef6ff3ac02c4f4d9efdf837ee517e11d7 # v0.2.0
+ uses: hyperpolymath/smtp-notify-action@1b3b752d39a4fe4c0f28f10905e4608789d3e050 # v0.1.0📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: MCP tools |
||||||
| with: | ||||||
| server_address: ${{ secrets.SMTP_HOST }} | ||||||
| server_port: ${{ secrets.SMTP_PORT }} | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: hyperpolymath/bofig
Length of output: 9841
🌐 Web query:
GitHub Actions push event branch deletion branches filter github.event.deleted true head_commit null💡 Result:
When a branch is deleted on GitHub, the push event is triggered, but the behavior of the GitHub Actions environment changes, often resulting in head_commit being null [1][2][3]. Because the push event includes branch deletions, workflows configured to trigger on push may unexpectedly run when a branch is deleted, which can cause issues such as unintended deployments [4][5]. Key Technical Details: - Push Event Behavior: When you delete a branch, GitHub sends a push event where the deleted property is set to true [2][6]. In this context, GITHUB_SHA and GITHUB_REF typically revert to the default branch of the repository, and the head_commit object in the webhook payload is often null [1][2][3]. - Handling Branch Deletion: You cannot directly filter branch deletions using the standard branches filter in the push event configuration [1][7]. To prevent a workflow from running on branch deletion, you must add a conditional check to your jobs using the github context [5][8]. Recommended Pattern: To filter out deleted branches within a push event, use an if conditional to check the github.event.deleted property [5]. jobs: my_job: runs-on: ubuntu-latest if: ${{!github.event.deleted }} steps: - run: echo "This only runs on actual pushes, not deletions." If you specifically want to handle branch deletions (e.g., for cleanup tasks), it is best practice to use the delete event instead of relying on the push event [2][8]. on: delete: jobs: on-delete: if: github.event.ref_type == 'branch' runs-on: ubuntu-latest steps: - run: echo "Branch ${{ github.event.ref }} was deleted." By using the delete event, you can accurately identify which branch was removed via github.event.ref, whereas in a push event, this information is often obscured because the environment defaults to the repository's main branch [9][8].
Citations:
Exclude branch-deletion events explicitly.
branches: ['**']does not exclude deleted branches. Whengithub.event.deletedistrue,head_commitcan benull, but the job still runs whenPUSH_EMAIL_ENABLEDistrue. Addgithub.event.deleted != trueto the job condition.🧰 Tools
🪛 zizmor (1.29.0)
[warning] 12-15: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting
(concurrency-limits)
🤖 Prompt for AI Agents
Source: MCP tools