chore: update actions/checkout to v7 and auto-maintain README SHA (#13) #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |