Skip to content

Commit 0240856

Browse files
authored
Copier update (action for dependabot) (#29)
Trying again
1 parent 9bd84a7 commit 0240856

File tree

6 files changed

+103
-120
lines changed

6 files changed

+103
-120
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: v0.0.41-2-g01ccd8c
2+
_commit: v0.0.41-10-g38b62f8
33
_src_path: gh:LabAutomationAndScreening/copier-base-template.git
44
description: Copier template for creating Python libraries and executables
55
python_ci_versions:
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Update Devcontainer Hash
2+
3+
inputs:
4+
branch:
5+
description: 'Branch to checkout and update'
6+
required: true
7+
8+
permissions:
9+
contents: write
10+
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Verify Dependabot actor
16+
if: ${{ github.actor != 'dependabot[bot]' }}
17+
run: |
18+
echo "Action can only be run by dependabot[bot], but was invoked by ${GITHUB_ACTOR}." >&2
19+
exit 1
20+
21+
- name: Checkout code
22+
uses: actions/checkout@v4.2.2
23+
with:
24+
persist-credentials: true
25+
fetch-depth: 1
26+
ref: ${{ inputs.branch }}
27+
28+
- name: Configure Git author
29+
run: |
30+
git config user.name "github-actions[bot]"
31+
git config user.email "github-actions[bot]@users.noreply.github.com"
32+
33+
- name: Update devcontainer hash
34+
run: |
35+
python3 .github/workflows/hash_git_files.py . --for-devcontainer-config-update --exit-zero
36+
37+
- name: Commit & push changes
38+
run: |
39+
if ! git diff --quiet; then
40+
git add .
41+
git commit -m "chore: update devcontainer hash [dependabot skip]"
42+
git push origin HEAD:${{ inputs.branch }}
43+
else
44+
echo "No changes to commit"
45+
fi

.github/workflows/ci.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ on:
55
branches-ignore:
66
- 'gh-readonly-queue/**' # don't run (again) when on these special branches created during merge groups; the `on: merge_group` already triggers it.
77
merge_group:
8-
workflow_dispatch:
98

109
env:
1110
PYTHONUNBUFFERED: True
@@ -16,7 +15,17 @@ permissions:
1615
contents: write # needed for mutex
1716

1817
jobs:
18+
get-values:
19+
runs-on: ubuntu-24.04
20+
steps:
21+
- name: Update Devcontainer Hash
22+
if: ${{ github.actor == 'dependabot[bot]' }}
23+
uses: ./.github/actions/update-devcontainer-hash
24+
with:
25+
branch: ${{ github.ref_name }}
26+
1927
pre-commit:
28+
needs: [ get-values ]
2029
strategy:
2130
fail-fast: false
2231
matrix:
@@ -29,6 +38,8 @@ jobs:
2938
steps:
3039
- name: Checkout code
3140
uses: actions/checkout@v4.2.2
41+
with:
42+
ref: ${{ github.ref_name }} # explicitly get the head of
3243

3344

3445

.github/workflows/dependabot-post-update.yaml

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Update Devcontainer Hash
2+
3+
inputs:
4+
branch:
5+
description: 'Branch to checkout and update'
6+
required: true
7+
8+
permissions:
9+
contents: write
10+
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Verify Dependabot actor
16+
if: ${{ github.actor != 'dependabot[bot]' }}
17+
run: |
18+
echo "Action can only be run by dependabot[bot], but was invoked by ${GITHUB_ACTOR}." >&2
19+
exit 1
20+
21+
- name: Checkout code
22+
uses: actions/checkout@v4.2.2
23+
with:
24+
persist-credentials: true
25+
fetch-depth: 1
26+
ref: ${{ inputs.branch }}
27+
28+
- name: Configure Git author
29+
run: |
30+
git config user.name "github-actions[bot]"
31+
git config user.email "github-actions[bot]@users.noreply.github.com"
32+
33+
- name: Update devcontainer hash
34+
run: |
35+
python3 .github/workflows/hash_git_files.py . --for-devcontainer-config-update --exit-zero
36+
37+
- name: Commit & push changes
38+
run: |
39+
if ! git diff --quiet; then
40+
git add .
41+
git commit -m "chore: update devcontainer hash [dependabot skip]"
42+
git push origin HEAD:${{ inputs.branch }}
43+
else
44+
echo "No changes to commit"
45+
fi

template/.github/workflows/dependabot-post-update.yaml

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)