forked from ibmruntimes/zoslib
-
Notifications
You must be signed in to change notification settings - Fork 1
Add GitHub Actions workflow for auto-tagging and notifications #7
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
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7c5d5bc
Add GitHub Actions workflow for auto-tagging and notifications
sachintu47 d42328c
Refactor auto-tag-notify workflow for security and stability
sachintu47 0f26af5
Update checkout step in auto-tag-notify workflow
sachintu47 bfa5f9b
Add release creation step in workflow
sachintu47 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: Auto-tag and notify downstream | ||
|
|
||
| on: | ||
| # Use pull_request_target so secrets are available even for fork-based PRs | ||
| pull_request_target: | ||
| types: [closed] | ||
| branches: [zopen2] | ||
| release: | ||
| types: [published] | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
sachintu47 marked this conversation as resolved.
|
||
|
|
||
| jobs: | ||
| auto-tag-and-notify: | ||
| if: > | ||
| (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true) || | ||
| github.event_name == 'release' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # Pin all actions to immutable commit SHAs for supply-chain security | ||
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | ||
|
sachintu47 marked this conversation as resolved.
|
||
| with: | ||
| # For pull_request_target: checkout the merge commit on zopen2 | ||
| # For release: checkout the release tag | ||
| ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.merge_commit_sha || github.event.release.tag_name }} | ||
|
sachintu47 marked this conversation as resolved.
|
||
| fetch-depth: 0 | ||
|
|
||
| # --- Tag creation (only on PR merge) --- | ||
| - name: Bump version and push tag | ||
| if: github.event_name == 'pull_request_target' | ||
| id: tag_version | ||
| uses: anothrNick/github-tag-action@4ed44965e0db8dab2b466a16da04aec3cc312fd8 # 1.75.0 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| DEFAULT_BUMP: patch | ||
| WITH_V: true | ||
| TAG_CONTEXT: branch | ||
|
|
||
| - name: Create release with notes | ||
| if: github.event_name == 'pull_request_target' && steps.tag_version.outputs.new_tag | ||
| uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2 | ||
| with: | ||
| tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
| name: ${{ steps.tag_version.outputs.new_tag }} | ||
| generate_release_notes: true | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # --- Downstream notification (runs even if tagging fails) --- | ||
| - name: Notify downstream zoslibport | ||
|
sachintu47 marked this conversation as resolved.
|
||
| if: '!cancelled()' | ||
| uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1 | ||
| with: | ||
| token: ${{ secrets.BUMP_TOKEN }} | ||
| repository: zopencommunity/zoslibport | ||
| event-type: upstream-release | ||
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Because this workflow also triggers on
release: published, a merge run that creates a release will cause a second run and likely dispatchupstream-releasetwice. Please confirm the downstream can handle duplicate notifications (or has a dedupe mechanism) so this doesn’t trigger redundant downstream work.Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.