-
Notifications
You must be signed in to change notification settings - Fork 1
Pulumi preview and new helper action to save on job executions #123
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
7 commits
Select commit
Hold shift + click to select a range
ea93ccb
Add preview comment on PR
zendern 8dfe40a
Bring in the check skip duplicate job logic
zendern 9b5504d
Accidentaly copied the get-values file and thus its symlinked. Fixed
zendern cbe2f85
Needs shell
zendern efbf643
Single quotes are good and bad 😂
zendern ba82a1a
Cleanup unneeded items
zendern 7c21006
Use env vars instead
zendern 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
44 changes: 44 additions & 0 deletions
44
template/template/.github/actions/check-skip-duplicates/action.yml.jinja-base
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,44 @@ | ||
| {% raw %}name: Check Skip Duplicates | ||
| description: 'Check that will output a variable to allow you to skip duplicate runs. Example: If you have both push and pull_request triggers enabled and you dont want to run 2 jobs for the same commit if a PR is already open you can add this to your jobs to skip that extra execution.' | ||
|
|
||
| outputs: | ||
| should-run: | ||
| description: 'Flag that determines if this execution should run or not' | ||
| value: ${{ steps.check.outputs.should_run }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Check if push has associated open PR | ||
| id: check | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| REF_NAME: ${{ github.ref_name }} | ||
| REPO_NAME: ${{ github.repository }} | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| shell: bash | ||
| run: | | ||
| # For non-push events, always run | ||
| if [ "$EVENT_NAME" != "push" ]; then | ||
| echo "should_run=true" >> $GITHUB_OUTPUT | ||
| echo "Event is $EVENT_NAME, will run CI" | ||
| exit 0 | ||
| fi | ||
|
|
||
| # For push events, check if there's an open PR for this branch | ||
| pr_json=$(gh pr list \ | ||
| --repo "$REPO_NAME" \ | ||
| --head "$REF_NAME" \ | ||
| --state open \ | ||
| --json number \ | ||
| --limit 1) | ||
|
|
||
| pr_number=$(echo "$pr_json" | jq -r '.[0].number // ""') | ||
|
|
||
| if [ -n "$pr_number" ]; then | ||
| echo "should_run=false" >> $GITHUB_OUTPUT | ||
| echo "Push to branch with open PR #$pr_number detected, skipping (PR event will run CI)" | ||
| else | ||
| echo "should_run=true" >> $GITHUB_OUTPUT | ||
| echo "Push to branch without open PR, will run CI" | ||
| fi{% endraw %} | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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
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
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.
🧹 Nitpick | 🔵 Trivial
Consider adding error handling for
gh pr listfailures.If
gh pr listfails (network error, rate limit, permission issue), the script silently continues with an empty result, defaulting toshould_run=true. While fail-open is a safe default, silent failures could mask configuration problems.♻️ Optional: Add basic error checking
📝 Committable suggestion
🤖 Prompt for AI Agents