-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (52 loc) · 1.67 KB
/
daily-post.yml
File metadata and controls
61 lines (52 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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: "22"
cache: npm
- name: Install dependencies
run: npm ci
- name: Post next queued item
env:
X_API_KEY: ${{ secrets.X_API_KEY }}
X_API_SECRET: ${{ secrets.X_API_SECRET }}
X_SOVREN_ACCESS_TOKEN: ${{ secrets.X_SOVREN_ACCESS_TOKEN }}
X_SOVREN_ACCESS_SECRET: ${{ secrets.X_SOVREN_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