File tree Expand file tree Collapse file tree 4 files changed +40
-2
lines changed
actions/update-devcontainer-hash
template/.github/actions/update-devcontainer-hash Expand file tree Collapse file tree 4 files changed +40
-2
lines changed Original file line number Diff line number Diff line change 11# Changes here will be overwritten by Copier
2- _commit : v0.0.41-18-gec81ebb
2+ _commit : v0.0.41-21-g8ca6c25
33_src_path : gh:LabAutomationAndScreening/copier-base-template.git
44description : Copier template for creating Python libraries and executables
55python_ci_versions :
Original file line number Diff line number Diff line change 88permissions :
99 contents : write
1010
11+ outputs :
12+ new-sha :
13+ description : ' The SHA of the branch tip after update'
14+ value : ${{ steps.commit-and-push.outputs.new-sha }}
15+ commit-created :
16+ description : ' Whether a new commit was created and pushed'
17+ value : ${{ steps.commit-and-push.outputs.commit-created }}
1118
1219runs :
1320 using : composite
@@ -38,12 +45,16 @@ runs:
3845 shell : bash
3946
4047 - name : Commit & push changes
48+ id : commit-and-push
4149 run : |
4250 if ! git diff --quiet; then
4351 git add .
4452 git commit -m "chore: update devcontainer hash [dependabot skip]"
4553 git push origin HEAD:${{ inputs.branch }}
54+ echo "commit-created=true" >> $GITHUB_OUTPUT
55+ echo "new-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
4656 else
4757 echo "No changes to commit"
58+ echo "commit-created=false" >> $GITHUB_OUTPUT
4859 fi
4960 shell : bash
Original file line number Diff line number Diff line change 1313permissions :
1414 id-token : write
1515 contents : write # needed for mutex
16+ statuses : write # needed for updating status on Dependabot PRs
1617
1718jobs :
1819 get-values :
1920 runs-on : ubuntu-24.04
21+ outputs :
22+ new-dependabot-sha : ${{ steps.update-hash.outputs.new-sha }}
23+ dependabot-commit-created : ${{ steps.update-hash.outputs.commit-created }}
2024 steps :
2125 - name : Checkout code
2226 uses : actions/checkout@v4.2.2
2327
2428 - name : Update Devcontainer Hash
2529 if : ${{ github.actor == 'dependabot[bot]' }}
30+ id : update-hash
2631 uses : ./.github/actions/update-devcontainer-hash
2732 with :
2833 branch : ${{ github.ref_name }}
@@ -170,10 +175,21 @@ jobs:
170175
171176 required-check :
172177 runs-on : ubuntu-24.04
173- needs : [ lint-matrix ]
178+ needs : [ lint-matrix, get-values ]
174179 if : always()
175180 steps :
176181 - name : fail if prior job failure
177182 if : needs.lint-matrix.result != 'success'
178183 run : |
179184 exit 1
185+ - name : Make updated dependabot hash commit as succeeded
186+ if : needs.get-values.outputs.dependabot-commit-created == 'true'
187+ run : |
188+ gh api \
189+ -X POST \
190+ -H "Accept: application/vnd.github.v3+json" \
191+ "/repos/${{ github.repository }}/statuses/${{ needs.get-values.outputs.new-dependabot-sha }}" \
192+ -f state=success \
193+ -f context="required-check" \
194+ -f description="Initial CI run passed" \
195+ -f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
Original file line number Diff line number Diff line change 88permissions :
99 contents : write
1010
11+ outputs :
12+ new-sha :
13+ description : ' The SHA of the branch tip after update'
14+ value : ${{ steps.commit-and-push.outputs.new-sha }}
15+ commit-created :
16+ description : ' Whether a new commit was created and pushed'
17+ value : ${{ steps.commit-and-push.outputs.commit-created }}
1118
1219runs :
1320 using : composite
@@ -38,12 +45,16 @@ runs:
3845 shell : bash
3946
4047 - name : Commit & push changes
48+ id : commit-and-push
4149 run : |
4250 if ! git diff --quiet; then
4351 git add .
4452 git commit -m "chore: update devcontainer hash [dependabot skip]"
4553 git push origin HEAD:${{ inputs.branch }}
54+ echo "commit-created=true" >> $GITHUB_OUTPUT
55+ echo "new-sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
4656 else
4757 echo "No changes to commit"
58+ echo "commit-created=false" >> $GITHUB_OUTPUT
4859 fi
4960 shell : bash
You can’t perform that action at this time.
0 commit comments