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 https://github.com/deviceofchoice/blog.git src/content | |
| LAST_COMMIT_MSG=$(git -C src/content log --oneline -1 | cut -d' ' -f2-) | |
| LAST_AUTHOR_NAME=$(git -C src/content log --format='%an' -1) | |
| LAST_AUTHOR_EMAIL=$(git -C src/content log --format='%ae' -1) | |
| rm -rf src/content/.git | |
| git config --global user.name "$LAST_AUTHOR_NAME" | |
| git config --global user.email "$LAST_AUTHOR_EMAIL" | |
| git add src/content | |
| git commit -m "[CONTENT] $LAST_COMMIT_MSG" || echo "No changes" | |
| git push |