Update ICAL Files #100
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 Calendar Files | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 * * * *' # Adjust the schedule as necessary | |
jobs: | |
update-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages # Specify to checkout the gh-pages branch | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: npm install | |
working-directory: .github/scripts | |
- name: Run script to update calendar files | |
run: npm start | |
working-directory: .github/scripts | |
env: | |
ICS_URL: ${{ secrets.ICS_URL }} | |
- name: Commit and push if there are changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add ical/calendar.ics ical/calendar.json | |
git commit -m "Update calendar files" -a || echo "No changes to commit" | |
git push origin gh-pages |