-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (77 loc) · 3.04 KB
/
Copy pathweekly-update.yml
File metadata and controls
87 lines (77 loc) · 3.04 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Weekly site update proposals
on:
# Enable after the dry-run verification pass (see .automation/README.md):
# uncomment the schedule block below.
# schedule:
# - cron: '0 0 * * 1' # 00:00 UTC Monday == 09:00 JST Monday
workflow_dispatch:
inputs:
dry_run:
type: boolean
default: true
description: Plan only — print proposals, write nothing, no PR
only:
type: string
description: 'Limit sources: inbox,slack,papers,audit (empty = all)'
window:
type: string
description: 'Backfill: publications since YYYY-MM-DD + full Slack history'
permissions:
contents: write
pull-requests: write
issues: write
jobs:
weekly:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Install Claude Code CLI
run: npm install -g @anthropic-ai/claude-code
- name: Collect, draft, apply
run: |
node scripts/weekly.mjs \
${{ (github.event_name == 'schedule' || inputs.dry_run != true) && ' ' || '--dry-run' }} \
${{ inputs.only && format('--only={0}', inputs.only) || '' }} \
${{ inputs.window && format('--window={0}', inputs.window) || '' }}
env:
# Subscription auth: generate once locally with `claude setup-token`
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
CLAUDE_MODEL: ${{ vars.CLAUDE_MODEL || 'sonnet' }}
GH_TOKEN: ${{ github.token }}
- name: Validate proposed content
if: ${{ github.event_name == 'schedule' || inputs.dry_run != true }}
run: node scripts/check-content.mjs
- name: Open / update proposal PR
if: ${{ github.event_name == 'schedule' || inputs.dry_run != true }}
uses: peter-evans/create-pull-request@v7
with:
branch: automation/weekly-proposals
title: 'Weekly site updates'
commit-message: 'weekly proposals [skip-translate]'
body-path: .automation/pr-body.md
labels: weekly-update
delete-branch: true
add-paths: |
src/content/**
src/i18n/**
_inbox/**
.automation/state.json
- name: File failure issue
if: failure()
run: |
existing=$(gh issue list --label automation-failure --state open --json number -q '.[0].number')
if [ -n "$existing" ]; then
gh issue comment "$existing" --body "Weekly run failed again: $RUN_URL"
else
gh issue create --title "Automation failure: weekly update" --label automation-failure \
--body "The weekly update workflow failed. See $RUN_URL. Common causes and fixes are in .automation/README.md."
fi
env:
GH_TOKEN: ${{ github.token }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}