-
Notifications
You must be signed in to change notification settings - Fork 1
Copier update: workflow summary #87
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 |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| 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 | ||
|
Comment on lines
+1
to
+44
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if the ci.yaml workflow has workflow-level permissions that would cover pull-requests: read
rg -n 'permissions:' -A 10 .github/workflows/ci.yaml | head -30Repository: LabAutomationAndScreening/copier-python-package-template Length of output: 1155 🏁 Script executed: # Check GitHub Actions documentation patterns and verify the output naming
# Look for any other composite actions in the repo to see how they handle outputs
fd -e yml -e yaml | xargs grep -l "outputs:" | head -5Repository: LabAutomationAndScreening/copier-python-package-template Length of output: 82 🏁 Script executed: # Get the full check-skip-duplicate job definition to see if it has a permissions block
sed -n '24,41p' .github/workflows/ci.yamlRepository: LabAutomationAndScreening/copier-python-package-template Length of output: 602 Add The Add a check-skip-duplicate:
runs-on: ubuntu-24.04
permissions:
pull-requests: read
outputs:
should-run: ${{ steps.check.outputs.should-run }}The rest of the action logic is sound—the handling of non-push events and the 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,23 +5,39 @@ on: | |||||||||||||||||||||||||||||||||||||||||
| branches-ignore: | ||||||||||||||||||||||||||||||||||||||||||
| - 'gh-readonly-queue/**' # don't run (again) when on these special branches created during merge groups; the `on: merge_group` already triggers it. | ||||||||||||||||||||||||||||||||||||||||||
| merge_group: | ||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||
| PYTHONUNBUFFERED: True | ||||||||||||||||||||||||||||||||||||||||||
| PRE_COMMIT_HOME: ${{ github.workspace }}/.precommit_cache | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||
| id-token: write # needed to assume OIDC roles (e.g. for downloading from CodeArtifact) | ||||||||||||||||||||||||||||||||||||||||||
| contents: read # need to explicitly provide this whenever defining permissions because the default value is 'none' for anything not explicitly set when permissions are defined | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||
| get-values: | ||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/get-values.yaml | ||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||
| contents: write # needed for updating dependabot branches | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| check-skip-duplicate: | ||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||||||||||||||||||||
| outputs: | ||||||||||||||||||||||||||||||||||||||||||
| should-run: ${{ steps.check.outputs.should-run }} | ||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v6.0.2 | ||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||
| persist-credentials: false | ||||||||||||||||||||||||||||||||||||||||||
| - id: check | ||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/actions/check-skip-duplicates | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| pre-commit: | ||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||
| - get-values | ||||||||||||||||||||||||||||||||||||||||||
| - check-skip-duplicate | ||||||||||||||||||||||||||||||||||||||||||
| if: needs.check-skip-duplicate.outputs.should-run == 'true' | ||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/pre-commit.yaml | ||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||
| contents: write # needed for mutex | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -32,6 +48,8 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| unit-test: | ||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||
| - pre-commit | ||||||||||||||||||||||||||||||||||||||||||
| - check-skip-duplicate | ||||||||||||||||||||||||||||||||||||||||||
| if: needs.check-skip-duplicate.outputs.should-run == 'true' | ||||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||||||||
| os: | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -66,6 +84,8 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| lint-matrix: | ||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||
| - pre-commit | ||||||||||||||||||||||||||||||||||||||||||
| - check-skip-duplicate | ||||||||||||||||||||||||||||||||||||||||||
| if: needs.check-skip-duplicate.outputs.should-run == 'true' | ||||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||||||||
| os: | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -175,11 +195,18 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| name: pre-commit-log--${{ github.jobs.lint-matrix.name }} | ||||||||||||||||||||||||||||||||||||||||||
| path: "${{ github.workspace }}/.precommit_cache/pre-commit.log" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| required-check: | ||||||||||||||||||||||||||||||||||||||||||
| confirm-on-tagged-copier-template: | ||||||||||||||||||||||||||||||||||||||||||
| if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | ||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/confirm-on-tagged-copier-template.yaml | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| workflow-summary: | ||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-24.04 | ||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 2 | ||||||||||||||||||||||||||||||||||||||||||
| needs: | ||||||||||||||||||||||||||||||||||||||||||
| - get-values | ||||||||||||||||||||||||||||||||||||||||||
| - check-skip-duplicate | ||||||||||||||||||||||||||||||||||||||||||
| - confirm-on-tagged-copier-template | ||||||||||||||||||||||||||||||||||||||||||
| - pre-commit | ||||||||||||||||||||||||||||||||||||||||||
| - unit-test | ||||||||||||||||||||||||||||||||||||||||||
| - lint-matrix | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -192,13 +219,27 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||
| success_pattern="^(skipped|success)$" # these are the possibilities: https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#needs-context | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| if [[ ! "${{ needs.get-values.result }}" =~ $success_pattern ]] || | ||||||||||||||||||||||||||||||||||||||||||
| [[ ! "${{ needs.confirm-on-tagged-copier-template.result }}" =~ $success_pattern ]] || | ||||||||||||||||||||||||||||||||||||||||||
| [[ ! "${{ needs.check-skip-duplicate.result }}" =~ $success_pattern ]] || | ||||||||||||||||||||||||||||||||||||||||||
| [[ ! "${{ needs.pre-commit.result }}" =~ $success_pattern ]] || | ||||||||||||||||||||||||||||||||||||||||||
| [[ ! "${{ needs.unit-test.result }}" =~ $success_pattern ]] || | ||||||||||||||||||||||||||||||||||||||||||
| [[ ! "${{ needs.lint-matrix.result }}" =~ $success_pattern ]]; then | ||||||||||||||||||||||||||||||||||||||||||
| echo "❌ One or more jobs did not finish with skipped or success" | ||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||
| echo "✅ All jobs finished with skipped or success" | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| - name: Mark the required-check as succeeded so the PR can be merged | ||||||||||||||||||||||||||||||||||||||||||
| if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} | ||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||
| gh api \ | ||||||||||||||||||||||||||||||||||||||||||
| -X POST -H "Accept: application/vnd.github.v3+json" \ | ||||||||||||||||||||||||||||||||||||||||||
| "${{ github.event.pull_request.statuses_url }}" \ | ||||||||||||||||||||||||||||||||||||||||||
| -f state=success -f context="required-check" -f description="✅ All required checks passed in the job triggered by pull_request" \ | ||||||||||||||||||||||||||||||||||||||||||
| -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+232
to
+241
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.
Same issue as in the template: the condition includes Proposed fix - name: Mark the required-check as succeeded so the PR can be merged
- if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
+ if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ github.token }}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| - name: Mark updated dependabot hash commit as succeeded | ||||||||||||||||||||||||||||||||||||||||||
| if: needs.get-values.outputs.dependabot-commit-created == 'true' | ||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: Confirm using tagged copier template version | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| answers_file: | ||
| description: 'Path to the copier answers file' | ||
| type: string | ||
| default: '.copier-answers.yml' | ||
|
|
||
| jobs: | ||
| confirm-on-tagged-copier-template: | ||
| runs-on: ubuntu-24.04 | ||
| timeout-minutes: 2 | ||
| name: Fail if template under development | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v6.0.2 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Check _commit is a clean release tag | ||
| run: | | ||
| ANSWERS_FILE="${{ inputs.answers_file }}" | ||
| if [ ! -f "$ANSWERS_FILE" ]; then | ||
| echo "Error: $ANSWERS_FILE not found" | ||
| exit 1 | ||
| fi | ||
| COMMIT_LINE=$(grep "^_commit:" "$ANSWERS_FILE") | ||
| if echo "$COMMIT_LINE" | grep -q "-"; then | ||
| echo "Error: $COMMIT_LINE" | ||
| echo "_commit must be a clean release tag (e.g. v0.0.111), not a dev commit (e.g. v0.0.106-14-g7847d7b)" | ||
| exit 1 | ||
| fi | ||
|
Comment on lines
+29
to
+34
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. 🧹 Nitpick | 🔵 Trivial Consider edge case: prerelease semver tags containing hyphens. The hyphen check correctly rejects git-describe dev commits (e.g., Optional: More precise git-describe detection- if echo "$COMMIT_LINE" | grep -q "-"; then
+ # git-describe format: v0.0.106-14-g7847d7b (tag-commits-gHASH)
+ if echo "$COMMIT_LINE" | grep -qE -- '-[0-9]+-g[0-9a-f]+'; then🤖 Prompt for AI Agents |
||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: LabAutomationAndScreening/copier-python-package-template
Length of output: 82
🏁 Script executed:
Repository: LabAutomationAndScreening/copier-python-package-template
Length of output: 1693
🏁 Script executed:
Repository: LabAutomationAndScreening/copier-python-package-template
Length of output: 1672
The Pulumi CLI install script referenced at line 139 does not exist in the repository.
The file
.devcontainer/install-pulumi-cli.shis missing. When the conditional logic evaluates to true (Linux platform, Pulumi in lock file, not skipping install),subprocess.run()withcheck=Truewill raise aCalledProcessErrorand crash the script. Either create the missing script or remove this installation logic.🤖 Prompt for AI Agents