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 Content on Dispatch | |
| on: | |
| repository_dispatch: | |
| types: [content-update] | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout main repo | |
| uses: actions/checkout@v4 | |
| - name: Update content and commit | |
| run: | | |
| rm -rf src/content | |
| git clone --depth=1 https://github.com/deviceofchoice/blog.git src/content | |
| cd src/content | |
| LAST_AUTHOR_NAME=$(git log --format='%an' -1) | |
| LAST_AUTHOR_EMAIL=$(git log --format='%ae' -1) | |
| cd .. | |
| rm -rf src/content/.git | |
| git rm --cached -r src/content || true | |
| git add src/content | |
| git config --global user.name "$LAST_AUTHOR_NAME" | |
| git config --global user.email "$LAST_AUTHOR_EMAIL" | |
| git commit -m "[CONTENT] Update" || echo "No changes" | |
| git push |