From f8fa5ce539f1b9fcbfef9281797a6b16a2de56d7 Mon Sep 17 00:00:00 2001 From: Eli Fine Date: Fri, 9 May 2025 12:38:52 +0000 Subject: [PATCH 1/3] script fix --- .../workflows/dependabot-post-update.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/template/.github/workflows/dependabot-post-update.yaml b/template/.github/workflows/dependabot-post-update.yaml index 4a6e7f3f..d4c0a66b 100644 --- a/template/.github/workflows/dependabot-post-update.yaml +++ b/template/.github/workflows/dependabot-post-update.yaml @@ -30,29 +30,30 @@ jobs: run: python3 .github/workflows/hash_git_files.py . --for-devcontainer-config-update --exit-zero - name: Commit & push changes + id: commit run: | - # only commit if there are changes if ! git diff --quiet; then git add . git commit -m "chore: apply post-Dependabot script changes [dependabot skip]" git push origin HEAD:${{ github.event.pull_request.head.ref }} + echo "pushed=true" >> $GITHUB_OUTPUT else - echo "No changes to commit" + echo "pushed=false" >> $GITHUB_OUTPUT fi - name: Dispatch CI on PR branch # pushes done by GITHUB_TOKEN don't trigger workflows, so we have to restart the CI job manually, see https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow + if: steps.commit.outputs.pushed == 'true' uses: actions/github-script@v7.0.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const run = context.payload.workflow_run; - const pr = run.pull_requests[0]; + const pr = context.payload.pull_request; if (!pr) { - throw new Error("No pull request linked to this workflow_run event; aborting dispatch."); + throw new Error("No pull_request found in payload; aborting dispatch."); } await github.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, + owner: context.repo.owner, + repo: context.repo.repo, workflow_id: "ci.yaml", - ref: run.head_branch, + ref: pr.head.ref, }); From 40338eeb16ac36bc225980ba421983c430b5db5a Mon Sep 17 00:00:00 2001 From: Eli Fine Date: Fri, 9 May 2025 12:40:49 +0000 Subject: [PATCH 2/3] cop --- .copier-answers.yml | 2 +- .github/workflows/dependabot-post-update.yaml | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index cc008633..2ee5af33 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.40 +_commit: v0.0.40-1-g4a61f48 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: Copier template for creating Python libraries and executables python_ci_versions: diff --git a/.github/workflows/dependabot-post-update.yaml b/.github/workflows/dependabot-post-update.yaml index 4a6e7f3f..d4c0a66b 100644 --- a/.github/workflows/dependabot-post-update.yaml +++ b/.github/workflows/dependabot-post-update.yaml @@ -30,29 +30,30 @@ jobs: run: python3 .github/workflows/hash_git_files.py . --for-devcontainer-config-update --exit-zero - name: Commit & push changes + id: commit run: | - # only commit if there are changes if ! git diff --quiet; then git add . git commit -m "chore: apply post-Dependabot script changes [dependabot skip]" git push origin HEAD:${{ github.event.pull_request.head.ref }} + echo "pushed=true" >> $GITHUB_OUTPUT else - echo "No changes to commit" + echo "pushed=false" >> $GITHUB_OUTPUT fi - name: Dispatch CI on PR branch # pushes done by GITHUB_TOKEN don't trigger workflows, so we have to restart the CI job manually, see https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow + if: steps.commit.outputs.pushed == 'true' uses: actions/github-script@v7.0.1 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const run = context.payload.workflow_run; - const pr = run.pull_requests[0]; + const pr = context.payload.pull_request; if (!pr) { - throw new Error("No pull request linked to this workflow_run event; aborting dispatch."); + throw new Error("No pull_request found in payload; aborting dispatch."); } await github.actions.createWorkflowDispatch({ - owner: context.repo.owner, - repo: context.repo.repo, + owner: context.repo.owner, + repo: context.repo.repo, workflow_id: "ci.yaml", - ref: run.head_branch, + ref: pr.head.ref, }); From 9bd4436bb6ffca21d5ce6919103cfbba4725e30e Mon Sep 17 00:00:00 2001 From: Eli Fine Date: Fri, 9 May 2025 12:42:44 +0000 Subject: [PATCH 3/3] tag --- .copier-answers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 2ee5af33..eea1fd0e 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.0.40-1-g4a61f48 +_commit: v0.0.41 _src_path: gh:LabAutomationAndScreening/copier-base-template.git description: Copier template for creating Python libraries and executables python_ci_versions: