Daily Worklog Update #134
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: Daily Worklog Update | |
| # Request write permission so the job can push changes using GITHUB_TOKEN | |
| permissions: | |
| contents: write | |
| on: | |
| schedule: | |
| # runs daily at 00:00 Africa/Lagos (UTC+1) -> 23:00 UTC previous day | |
| - cron: '0 23 * * *' | |
| workflow_dispatch: {} | |
| jobs: | |
| update-worklog: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # ensure the action can push using the provided token | |
| persist-credentials: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.x' | |
| - name: Generate yesterday's worklog section | |
| run: | | |
| YESTERDAY=$(date -u -d '1 day ago' +%Y-%m-%d) | |
| python scripts/generate_worklog.py --day "$YESTERDAY" | |
| - name: Commit changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "Enya Elvis" | |
| git config user.email "enyaelvis@gmail.com" | |
| git add worklogs/*.md | |
| git commit -m "chore(worklog): daily update (auto)" || echo "no changes" | |
| # configure authenticated remote using the token so push succeeds | |
| git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }} | |
| git push origin HEAD:${{ github.ref_name }} |