-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
60 lines (52 loc) · 1.7 KB
/
action.yml
File metadata and controls
60 lines (52 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Update Devcontainer Hash
inputs:
branch:
description: 'Branch to checkout and update'
required: true
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
steps:
- name: Verify Dependabot actor
if: ${{ github.actor != 'dependabot[bot]' }}
run: |
echo "Action can only be run by dependabot[bot], but was invoked by ${GITHUB_ACTOR}." >&2
exit 1
shell: bash
- name: Checkout code
uses: actions/checkout@v4.2.2
with:
persist-credentials: true
fetch-depth: 1
ref: ${{ inputs.branch }}
- name: Configure Git author
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
shell: bash
- name: Update devcontainer hash
run: |
python3 .github/workflows/hash_git_files.py . --for-devcontainer-config-update --exit-zero
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