Sync profile README #6
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: Sync profile README | |
| on: | |
| push: | |
| paths: | |
| - 'README.md' | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: true | |
| fetch-depth: 0 | |
| - name: Ensure folder exists | |
| run: mkdir -p .github/profile | |
| - name: Copy README.md to profile folder | |
| run: cp README.md .github/profile/README.md | |
| - name: 'Debug: show content of source and destination' | |
| run: | | |
| echo "===== Root README.md =====" | |
| head -n 10 README.md | |
| echo "===== .github/profile/README.md =====" | |
| head -n 10 .github/profile/README.md | |
| - name: Commit changes if any | |
| run: | | |
| if ! git diff --exit-code HEAD -- .github/profile/README.md; then | |
| git add .github/profile/README.md | |
| git -c user.name="${{ github.actor }}" \ | |
| -c user.email="${{ github.actor }}@users.noreply.github.com" \ | |
| commit -m "chore: sync .github/profile/README.md from root README.md" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi |