Repository navigation
chore(ci): repoint push-email-notify to smtp-notify-action #78
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/grim-repo
Length of output: 239
🏁 Script executed:
Repository: hyperpolymath/grim-repo
Length of output: 4071
🌐 Web query:
GitHub Actions push event branches filter deleted branch deleted true head_commit null workflow💡 Result:
When a Git branch is deleted in a GitHub repository, a push event is triggered for the default branch, which can inadvertently cause workflows configured for that branch to run [1][2][3]. Key Technical Details: 1. Push Event Behavior: When you delete a branch, the push event's payload includes
"deleted": true[2][3]. During this specific event, thehead_commitfield in the webhook payload is set tonullbecause there is no new commit associated with the deletion—the repository state simply reverts to the current tip of the default branch [4][2][3]. 2. Filtering Deleted Branches: - To prevent workflows from running on these "deleted branch" push events, you can use a conditional job or step in your workflow file. You can check thedeletedproperty in the event payload [3]. - Example: Add anifcondition to your job to skip execution when a branch deletion occurs:yaml jobs: build: if: ${{ !github.event.deleted }} runs-on: ubuntu-latest steps: - run: echo "This job will not run on branch deletion."3. Separate Trigger for Deletions: - If your goal is to perform tasks specifically when a branch is deleted (e.g., cleaning up resources), use thedeleteevent trigger instead of relying on thepushevent [2][5]. - Note that thedeleteevent workflow must exist on the default branch to trigger [6][5][7]. - You can filter thedeleteevent to respond only to branches using:yaml on: delete: jobs: cleanup: if: github.event.ref_type == 'branch' runs-on: ubuntu-latest steps: - run: echo "Branch ${{ github.event.ref }} was deleted."In summary, thepushevent triggers for branch deletions with anullhead_commitanddeleted: true. You should use conditional logic (!github.event.deleted) to filter these out of standardpushworkflows or use the dedicateddeleteevent for cleanup tasks [8][3].Citations:
🌐 Web query:
site:docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows push deleted branch head_commit branches filter💡 Result:
The terms provided relate to configuring GitHub Actions workflows rather than a specific Git command sequence. In the context of GitHub Actions, the branches filter is used within a workflow file to limit which branches trigger the execution of that workflow upon a push event [1]. For example, to configure a workflow to run only when a push occurs on specific branches, you define the branches filter as follows [1]: on: push: branches: - 'main' - 'releases/' Regarding your query about deleting a branch and head commits: when a branch is deleted in a repository, the SHA associated with the workflow run for that push event reverts to the default branch of the repository [1]. Additionally, you can target the head of a pull request within a workflow using context variables such as github.head_ref or github.event.pull_request.head.sha [1].
Citations:
🌐 Web query:
"delete a branch" "push event" "head_commit" GitHub Actions branches💡 Result:
When a branch is deleted on GitHub, it can trigger either a delete event or a push event, depending on how your repository's webhooks or workflow triggers are configured [1][2][3]. 1. The delete event: If you use the delete trigger in your workflow (on: delete), GitHub Actions will run the workflow when a Git reference (branch or tag) is deleted [1][4]. The head_commit context is not applicable for this event [1]. Within the workflow, you can access the name of the deleted branch using github.event.ref and filter for branches specifically using github.event.ref_type == 'branch' [5][4][6]. 2. The push event: Deleting a branch also generates a push event where the 'after' SHA is 0000000000000000000000000000000000000000 and the 'deleted' flag in the payload is set to true [2][3]. In this scenario, the head_commit object in the GitHub Actions context is typically null [7][3]. If your workflow is configured to run on push events, it may still trigger unless you explicitly add logic to ignore events where deleted is true [2][3]. To handle these scenarios, it is recommended to use the delete event for specific branch-deletion tasks, using the github.event context to identify the deleted reference [5][4]. If you are relying on push triggers, ensure your workflow steps check for the branch deletion payload state to prevent errors [2][3].
Citations:
Exclude deleted branch push payloads.
A branch deletion can produce a
pushpayload withdeleted: trueandhead_commit: null.branches: ['**']does not exclude it, so the enablednotifyjob can send an incorrect notification.Add
github.event.deleted != trueto the job condition.🤖 Prompt for AI Agents
Source: MCP tools