Skip to content

try

try #8

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