-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (73 loc) · 2.57 KB
/
Copy pathrefresh-data.yml
File metadata and controls
84 lines (73 loc) · 2.57 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
name: Refresh Release Data
on:
schedule:
# Run weekly on Thursdays at 9:00 UTC (after GB releases on Wednesday)
- cron: '0 9 * * 4'
workflow_dispatch:
inputs:
from_version:
description: 'Parse from version (optional)'
required: false
to_version:
description: 'Parse to version (optional)'
required: false
contributor_aggregates:
description: 'Contributor aggregates (sponsor/country breakdown)'
type: choice
default: 'auto'
options:
- 'auto'
- 'skip'
- 'force-all'
jobs:
refresh:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
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: Parse releases
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -n "${{ github.event.inputs.from_version }}" ] || [ -n "${{ github.event.inputs.to_version }}" ]; then
ARGS=""
[ -n "${{ github.event.inputs.from_version }}" ] && ARGS="$ARGS --from ${{ github.event.inputs.from_version }}"
[ -n "${{ github.event.inputs.to_version }}" ] && ARGS="$ARGS --to ${{ github.event.inputs.to_version }}"
npm run data-sync:gb-releases -- $ARGS
else
npm run data-sync:gb-releases
fi
- name: Aggregate data
run: npm run data-sync:wp-cycles
- name: Compute contributor aggregates
if: ${{ github.event.inputs.contributor_aggregates != 'skip' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ github.event.inputs.contributor_aggregates }}" == "force-all" ]; then
npm run data-sync:contributor-stats -- --force --delay 300
else
npm run data-sync:contributor-stats -- --delay 300
fi
- name: Check for changes
id: changes
run: |
git diff --quiet public/data/ || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push changes
if: steps.changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add public/data/
git commit -m "Update release data
Automated refresh of Gutenberg release statistics."
git push