Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v0.0.41-18-gec81ebb
_commit: v0.0.41-21-g8ca6c25
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
description: Copier template for creating Python libraries and executables
python_ci_versions:
Expand Down
11 changes: 11 additions & 0 deletions .github/actions/update-devcontainer-hash/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ inputs:
permissions:
contents: write

outputs:
new-sha:
description: 'The SHA of the branch tip after update'
value: ${{ steps.commit-and-push.outputs.new-sha }}
commit-created:
description: 'Whether a new commit was created and pushed'
value: ${{ steps.commit-and-push.outputs.commit-created }}

runs:
using: composite
Expand Down Expand Up @@ -38,12 +45,16 @@ runs:
shell: bash

- name: Commit & push changes
id: commit-and-push
run: |
if ! git diff --quiet; then
git add .
git commit -m "chore: update devcontainer hash [dependabot skip]"
git push origin HEAD:${{ inputs.branch }}
echo "commit-created=true" >> $GITHUB_OUTPUT
echo "new-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
else
echo "No changes to commit"
echo "commit-created=false" >> $GITHUB_OUTPUT
fi
shell: bash
18 changes: 17 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ env:
permissions:
id-token: write
contents: write # needed for mutex
statuses: write # needed for updating status on Dependabot PRs

jobs:
get-values:
runs-on: ubuntu-24.04
outputs:
new-dependabot-sha: ${{ steps.update-hash.outputs.new-sha }}
dependabot-commit-created: ${{ steps.update-hash.outputs.commit-created }}
steps:
- name: Checkout code
uses: actions/checkout@v4.2.2

- name: Update Devcontainer Hash
if: ${{ github.actor == 'dependabot[bot]' }}
id: update-hash
uses: ./.github/actions/update-devcontainer-hash
with:
branch: ${{ github.ref_name }}
Expand Down Expand Up @@ -170,10 +175,21 @@ jobs:

required-check:
runs-on: ubuntu-24.04
needs: [ lint-matrix ]
needs: [ lint-matrix, get-values ]
if: always()
steps:
- name: fail if prior job failure
if: needs.lint-matrix.result != 'success'
run: |
exit 1
- name: Make updated dependabot hash commit as succeeded
if: needs.get-values.outputs.dependabot-commit-created == 'true'
run: |
gh api \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
"/repos/${{ github.repository }}/statuses/${{ needs.get-values.outputs.new-dependabot-sha }}" \
-f state=success \
-f context="required-check" \
-f description="Initial CI run passed" \
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
11 changes: 11 additions & 0 deletions template/.github/actions/update-devcontainer-hash/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ inputs:
permissions:
contents: write

outputs:
new-sha:
description: 'The SHA of the branch tip after update'
value: ${{ steps.commit-and-push.outputs.new-sha }}
commit-created:
description: 'Whether a new commit was created and pushed'
value: ${{ steps.commit-and-push.outputs.commit-created }}

runs:
using: composite
Expand Down Expand Up @@ -38,12 +45,16 @@ runs:
shell: bash

- name: Commit & push changes
id: commit-and-push
run: |
if ! git diff --quiet; then
git add .
git commit -m "chore: update devcontainer hash [dependabot skip]"
git push origin HEAD:${{ inputs.branch }}
echo "commit-created=true" >> $GITHUB_OUTPUT
echo "new-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
else
echo "No changes to commit"
echo "commit-created=false" >> $GITHUB_OUTPUT
Copy link

Copilot AI May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider outputting a default value for 'new-sha' in the branch where no changes are committed. This would provide a consistent output structure for dependent workflows even when no commit is created.

Suggested change
echo "commit-created=false" >> $GITHUB_OUTPUT
echo "commit-created=false" >> $GITHUB_OUTPUT
echo "new-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

Copilot uses AI. Check for mistakes.
fi
shell: bash