-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (81 loc) · 2.78 KB
/
weekly-watch.yml
File metadata and controls
92 lines (81 loc) · 2.78 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
88
89
90
91
92
name: Weekly Source Watch
on:
schedule:
- cron: '0 9 * * 1' # Every Monday at 09:00 UTC
workflow_dispatch:
inputs:
watcher:
description: 'Run a specific watcher (owasp|arxiv|nvd|frameworks) or leave blank for all'
required: false
default: ''
dry_run:
description: 'Dry run (no issues opened)'
type: boolean
default: false
permissions:
issues: write
contents: read
jobs:
watch:
name: Monitor external sources
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Restore watch state
uses: actions/cache@v4
with:
path: data/.watch-state.json
key: watch-state-${{ github.run_id }}
restore-keys: |
watch-state-
- name: Run source watchers
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
FLAGS=""
if [ "${{ inputs.dry_run }}" = "true" ]; then FLAGS="$FLAGS --dry-run"; fi
if [ -n "${{ inputs.watcher }}" ]; then FLAGS="$FLAGS --watcher ${{ inputs.watcher }}"; fi
node scripts/watch.js $FLAGS
monthly-regenerate:
name: Monthly report regeneration
if: github.event.schedule == '0 9 * * 1' && (github.event.schedule != '' || github.event_name == 'workflow_dispatch')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Regenerate data layer and reports
run: |
node scripts/generate.js
node scripts/compliance-report.js
node scripts/incidents-report.js
- name: Check for changes
id: diff
run: |
git diff --quiet || echo "changed=true" >> "$GITHUB_OUTPUT"
- name: Create PR with updated reports
if: steps.diff.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH="auto/monthly-regenerate-$(date +%Y%m%d)"
git checkout -b "$BRANCH"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "chore: monthly regeneration of data layer and compliance reports"
git push origin "$BRANCH"
gh pr create \
--title "chore: monthly report regeneration ($(date +%Y-%m-%d))" \
--body "Automated monthly regeneration of data/entries/, reports/, and docs/data.js." \
--label automated-watch