start renaming files #2
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
name: Sync TryHackMe writeups to Blog | |
on: | |
push: | |
paths: | |
- 'tryhackme-room-writeups/**' | |
branches: | |
- main | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout TryHackMe repo | |
uses: actions/checkout@v3 | |
- name: Setup Git | |
run: | | |
git config --global user.name "github-actions" | |
git config --global user.email "[email protected]" | |
- name: Clone Astro Repo | |
run: | | |
git clone https://x-access-token:${{ secrets.THM_SYNC_PAT }}@github.com/TaraScho/tc-homepage-astro.git tc-homepage-astro | |
- name: Sync Files | |
run: | | |
rsync -av --delete tryhackme-room-writeups/ tc-homepage-astro/src/pages/blog/tryhackme/tryhackme-room-writeups/ | |
- name: Commit and Push Changes | |
run: | | |
set -e # Exit on error | |
cd tc-homepage-astro | |
# Check for changes before adding/committing | |
if git diff --quiet; then | |
echo "No changes detected, skipping commit." | |
exit 0 | |
fi | |
git add . | |
git commit -m "Sync TryHackMe writeups from TryHackMe MD Repo" | |
git push origin main |