Daily Thesis Post #1
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 Thesis Post | |
| # Posts the next pending item from content-queue.json at 10 AM ET (14:00 UTC). | |
| # Commits the updated queue back so posted status is tracked in git. | |
| on: | |
| schedule: | |
| - cron: "0 14 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Preview only, no post" | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| post: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Post next queued item | |
| env: | |
| TWITTER_API_KEY: ${{ secrets.TWITTER_API_KEY }} | |
| TWITTER_API_SECRET: ${{ secrets.TWITTER_API_SECRET }} | |
| TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }} | |
| TWITTER_ACCESS_SECRET: ${{ secrets.TWITTER_ACCESS_SECRET }} | |
| run: | | |
| if [ "${{ inputs.dry_run }}" == "true" ]; then | |
| node scripts/daily-post.js --dry-run | |
| else | |
| node scripts/daily-post.js | |
| fi | |
| - name: Commit queue update | |
| if: inputs.dry_run != 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if git diff --quiet scripts/content-queue.json; then | |
| echo "No queue changes to commit (no post was due or post failed)" | |
| else | |
| git add scripts/content-queue.json | |
| git commit -m "post: mark queued item as posted [automated]" | |
| git push | |
| fi |