-
-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (37 loc) · 1.07 KB
/
Copy pathupdate-readme-sha.yml
File metadata and controls
41 lines (37 loc) · 1.07 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
name: Update README SHA reference
on:
push:
branches:
- main
paths-ignore:
- 'README.md'
- '**.md'
- 'LICENSE'
- '.github/FUNDING.yml'
jobs:
update-sha:
name: Update pinned SHA in README
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: main
fetch-depth: 2
- name: Update SHA in README.md
run: |
NEW_SHA="${{ github.sha }}"
sed -i "s|ref: [0-9a-f]\{40\}|ref: ${NEW_SHA}|g" README.md
- name: Commit updated README.md
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet README.md; then
echo "No SHA change detected, skipping commit."
else
git add README.md
git commit -m "chore: update pinned SHA in README to ${{ github.sha }}"
git push
fi