Sync Webpack #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: Sync Webpack | |
| on: | |
| schedule: | |
| # Run every 24 hours at 04:00 UTC | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Get latest webpack commit | |
| id: latest | |
| run: | | |
| LATEST=$(git ls-remote https://github.com/webpack/webpack.git refs/heads/main | cut -f1) | |
| CURRENT=$(cat HEAD_COMMIT) | |
| echo "latest=$LATEST" >> "$GITHUB_OUTPUT" | |
| echo "current=$CURRENT" >> "$GITHUB_OUTPUT" | |
| echo "Latest webpack commit: $LATEST" | |
| echo "Current pinned commit: $CURRENT" | |
| - name: Check for changes | |
| id: check | |
| run: | | |
| if [ "${{ steps.latest.outputs.latest }}" = "${{ steps.latest.outputs.current }}" ]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| echo "No changes detected, skipping sync." | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| echo "New webpack commit detected, syncing." | |
| fi | |
| - name: Setup Node.js | |
| if: steps.check.outputs.changed == 'true' | |
| uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0 | |
| with: | |
| node-version: lts/* | |
| cache: 'npm' | |
| - name: Install dependencies | |
| if: steps.check.outputs.changed == 'true' | |
| run: npm ci | |
| - name: Update HEAD_COMMIT | |
| if: steps.check.outputs.changed == 'true' | |
| run: echo "${{ steps.latest.outputs.latest }}" > HEAD_COMMIT | |
| - name: Clone webpack | |
| if: steps.check.outputs.changed == 'true' | |
| run: npm run clone-webpack | |
| - name: Regenerate docs | |
| if: steps.check.outputs.changed == 'true' | |
| run: npm run generate-docs | |
| - name: Create pull request | |
| if: steps.check.outputs.changed == 'true' | |
| uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| commit-message: 'chore: sync webpack docs to ${{ steps.latest.outputs.latest }}' | |
| title: 'chore: sync webpack docs to ${{ steps.latest.outputs.latest }}' | |
| body: | | |
| Automated update of webpack docs. | |
| - Latest webpack commit: ${{ steps.latest.outputs.latest }} | |
| - Previous commit: ${{ steps.latest.outputs.current }} | |
| branch: 'chore/sync-webpack' |