|
| 1 | +name: WPT update |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run once a week at 12:00 AM UTC on Sunday. |
| 6 | + - cron: 0 0 * * * |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + subsystems: |
| 10 | + description: Subsystem to run the update for |
| 11 | + required: false |
| 12 | + default: '["url", "WebCryptoAPI"]' |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +env: |
| 18 | + NODE_VERSION: lts/* |
| 19 | + |
| 20 | +jobs: |
| 21 | + wpt-subsystem-update: |
| 22 | + if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch' |
| 23 | + runs-on: ubuntu-latest |
| 24 | + strategy: |
| 25 | + fail-fast: false |
| 26 | + matrix: |
| 27 | + subsystem: ${{ fromJSON(github.event.inputs.subsystems || '["url", "WebCryptoAPI"]') }} |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@6d193bf28034eafb982f37bd894289fe649468fc # v4.1.7 |
| 31 | + with: |
| 32 | + persist-credentials: false |
| 33 | + |
| 34 | + - name: Install Node.js |
| 35 | + uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 |
| 36 | + with: |
| 37 | + node-version: ${{ env.NODE_VERSION }} |
| 38 | + |
| 39 | + - name: Install @node-core/utils |
| 40 | + run: npm install -g @node-core/utils |
| 41 | + |
| 42 | + - name: Setup @node-core/utils |
| 43 | + run: | |
| 44 | + ncu-config set username "$USERNAME" |
| 45 | + ncu-config set token "$GH_TOKEN" |
| 46 | + ncu-config set jenkins_token "$JENKINS_TOKEN" |
| 47 | + ncu-config set owner "${{ github.repository_owner }}" |
| 48 | + ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)" |
| 49 | + env: |
| 50 | + USERNAME: ${{ secrets.JENKINS_USER }} |
| 51 | + GH_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
| 52 | + JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }} |
| 53 | + |
| 54 | + - name: Update WPT for subsystem ${{ matrix.subsystem }} |
| 55 | + run: | |
| 56 | + git node wpt ${{ matrix.subsystem }} |
| 57 | +
|
| 58 | + - name: Calculate new version for WPT using jq |
| 59 | + run: | |
| 60 | + new_version=$(jq -r '.${{ matrix.subsystem }}.commit' test/fixtures/wpt/versions.json) |
| 61 | + echo "new_version=$new_version" >> $GITHUB_ENV |
| 62 | +
|
| 63 | + - name: Open or update PR for the subsystem update |
| 64 | + uses: gr2m/create-or-update-pull-request-action@86ec1766034c8173518f61d2075cc2a173fb8c97 |
| 65 | + with: |
| 66 | + branch: actions/update-wpt-${{ matrix.subsystem }} |
| 67 | + author: Node.js GitHub Bot <github-bot@iojs.org> |
| 68 | + title: 'test: update WPT for ${{ matrix.subsystem }} to ${{ env.new_version }}' |
| 69 | + commit-message: 'test: update WPT for ${{ matrix.subsystem }} to ${{ env.new_version }}' |
| 70 | + labels: test |
| 71 | + update-pull-request-title-and-body: true |
| 72 | + body: | |
| 73 | + This is an automated update of the WPT for ${{ matrix.subsystem }} to ${{ env.new_version }}. |
| 74 | + env: |
| 75 | + GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} |
0 commit comments