Refresh Release Data #24
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: 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 |