Update ICAL Files #623
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: Update ICAL Files | |
on: | |
push: | |
branches: | |
- main # Trigger on push to main, or adjust as needed | |
schedule: | |
- cron: '0 12 * * *' # Optionally, schedule to run daily | |
jobs: | |
update-ical: | |
name: Get ICS and Process | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
with: | |
ref: main # Specify the branch to checkout | |
path: main | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages # Specify the branch to checkout | |
path: gh-pages | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '14' # Specify your Node.js version | |
- name: Install dependencies | |
run: npm install # Assuming your script needs npm packages | |
working-directory: ./main/.github/scripts | |
- name: Update ICAL File | |
run: node index.js --action # Run your specific script | |
working-directory: ./main/.github/scripts | |
- name: Commit and push if there are changes | |
run: | | |
cd gh-pages | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add calendar.ics ical/calendar.json | |
git commit -m "Update calendar files" -a || echo "No changes to commit" | |
git push origin gh-pages |