Update README.md #60
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: Run Sync Script | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
run-sync-script: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Python dependencies | |
run: | | |
cd config | |
if [ -f requirements.txt ]; then | |
cat requirements.txt | |
pip install -r requirements.txt | |
fi | |
- name: Run sync.py script | |
run: | | |
cd config | |
python3 sync.py | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Changes detected" | |
echo "changes=true" >> $GITHUB_ENV | |
else | |
echo "No changes detected" | |
echo "changes=false" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Commit and push changes | |
if: env.changes == 'true' | |
run: | | |
FIRST_NAME="Max" | |
DOMAIN="gmail.com" | |
EMAIL="${FIRST_NAME}BaseCode@${DOMAIN}" | |
git config --global user.name "Max Base (GitHub Actions)" | |
git config --global user.email "$EMAIL" | |
git add -A | |
git commit -m "Auto-sync: Update after running sync.py script" | |
git push https://x-access-token:${{ secrets.USER_TOKEN }}@github.com/${{ github.repository }}.git |