Generate Daily Devos Template #303
This file contains hidden or 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: Generate Daily Devos Template | |
| on: | |
| schedule: | |
| - cron: '0 10 * * * ' # Every day at 10:00 AM UTC or approximately 3:00 AM PT (depending on daylight saving time) | |
| workflow_dispatch: # For testing purposes | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate-devos-template: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate Devos Template | |
| run: | | |
| npm run build | |
| npm run start | |
| - name: Get current date in PDT | |
| id: pdt_date | |
| run: echo "PDT_DATE=$(TZ=America/Los_Angeles date '+%Y-%m-%d')" >> $GITHUB_OUTPUT | |
| - name: Cache the file - to be used in deployment workflow | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.pdt_date.outputs.PDT_DATE }} | |
| path: ./output.txt | |
| if-no-files-found: error | |
| retention-days: 7 | |
| overwrite: false | |
| include-hidden-files: false | |
| - name: Push output as current.md | |
| run: | | |
| cp output.txt current.md | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add current.md | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit." | |
| else | |
| git commit -m "chore: update current.md [skip ci]" | |
| git pull --rebase | |
| git push | |
| fi |