This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
Blog #42
This file contains 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
# Ingest repository_dispatch events for syncing blog posts | |
name: Blog Posts Listener | |
on: | |
repository_dispatch: | |
types: [Blog] | |
jobs: | |
sync-blog-posts: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Configure Git and Create Branch | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "DX-Bandwidth" | |
git checkout -b sync-blog-posts | |
- name: Update Blog Posts File | |
run: | | |
cat > ./site/blogposts.config.json <<< $POSTS_JSON | |
env: | |
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }} | |
POSTS_JSON: ${{ toJson(github.event.client_payload.posts) }} | |
- name: Commit Changes and Create Pull Request | |
run: | | |
if git diff-index --quiet HEAD | |
then | |
echo 'nothing to commit, working tree clean' | |
else | |
git add site/blogposts.config.json | |
git commit -m 'update blog posts' | |
git push origin sync-blog-posts | |
gh pr create -B main -H sync-blog-posts --title 'SWI-3460 Update Blog Posts' --body 'Auto-generated by Blog Posts Listener Workflow' | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }} |