|
| 1 | +name: Update Test262 tests |
| 2 | + |
| 3 | +on: |
| 4 | + # Trigger at every Sunday UTC noon, or manually. |
| 5 | + schedule: |
| 6 | + - cron: '0 12 * * 0' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + update-test262: |
| 11 | + runs-on: ubuntu-24.04 |
| 12 | + steps: |
| 13 | + - name: Checkout WPT repo |
| 14 | + uses: actions/checkout@v4 |
| 15 | + with: |
| 16 | + path: wpt |
| 17 | + - name: Checkout Test262 repo |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + repository: tc39/test262 |
| 21 | + path: test262-spec |
| 22 | + - name: Copy Test262 tests to WPT |
| 23 | + run: | |
| 24 | + rsync -a --delete test262-spec/test/ wpt/tc39/test262/test/ |
| 25 | + rsync -a --delete test262-spec/harness/ wpt/tc39/test262/harness/ |
| 26 | + - name: Commit changes |
| 27 | + id: commit |
| 28 | + continue-on-error: true |
| 29 | + run: | |
| 30 | + cd wpt |
| 31 | + export BRANCH_NAME="$BRANCH_PREFIX-$(date +'%Y%m%d%H%M%S')" |
| 32 | + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV |
| 33 | + git config user.name "$GIT_AUTHOR_NAME" |
| 34 | + git config user.email "$GIT_AUTHOR_EMAIL" |
| 35 | + git checkout -b $BRANCH_NAME |
| 36 | + git add tc39/test262/ |
| 37 | + git commit -m "$COMMIT_TITLE" |
| 38 | + env: |
| 39 | + GIT_AUTHOR_NAME: "wpt-pr-bot" |
| 40 | + GIT_AUTHOR_EMAIL: "wpt-pr-bot@users.noreply.github.com" |
| 41 | + BRANCH_PREFIX: "test262-update" |
| 42 | + COMMIT_TITLE: "Update Test262 tests" |
| 43 | + - name: Create PR |
| 44 | + if: ${{ steps.commit.outcome == 'success' }} |
| 45 | + run: | |
| 46 | + cd wpt |
| 47 | + git push --set-upstream origin $BRANCH_NAME |
| 48 | + gh pr create --title "$COMMIT_TITLE" --body "$PR_BODY" |
| 49 | + env: |
| 50 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + COMMIT_TITLE: "Update Test262 tests" |
| 52 | + PR_BODY: "Scheduled weekly update auto-generated by the '${{ github.workflow }}' workflow." |
0 commit comments