From d16b99be217c5c71ba721a151ce2f93611009d0a Mon Sep 17 00:00:00 2001 From: tony-go Date: Mon, 7 Feb 2022 18:19:06 +0100 Subject: [PATCH 01/16] chore: automate compat-data update --- .github/workflows/update-compat-data.yml | 78 +++++++++++++++++++ .../bump-data-compat-version.sh | 7 ++ .../compare-with-current-commit.js | 49 ++++++++++++ scripts/update-compat-data/get-last-commit.sh | 4 + 4 files changed, 138 insertions(+) create mode 100644 .github/workflows/update-compat-data.yml create mode 100644 scripts/update-compat-data/bump-data-compat-version.sh create mode 100644 scripts/update-compat-data/compare-with-current-commit.js create mode 100644 scripts/update-compat-data/get-last-commit.sh diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml new file mode 100644 index 000000000000..9e68a4dd3371 --- /dev/null +++ b/.github/workflows/update-compat-data.yml @@ -0,0 +1,78 @@ +name: Update compat data +env: + YARN_ENABLE_SCRIPTS: false # disable post-install scripts +on: + workflow_dispatch: + inputs: {} + schedule: + - cron: "0 0 * * 5" + +jobs: + createPullRequest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + with: + repository: kangax/compat-table + path: packages/babel-compat-data/build/compat-table + - name: Use Node.js latest + uses: actions/setup-node@v2-beta + with: + node-version: "*" + - name: Get latest kangax/compat-data commit + id: lastCommit + run: echo "::set-output name=sha1::$(node ./scripts/update-compat-data/get-last-commit.sh)" + - name: Compare last kangax/compat-data commit with current one + run: echo ${{ steps.lastCommit.outputs.sha1 }} | node ./scripts/update-compat-data/compare-with-current-commit.js + - name: Update compat-data commit + run: echo ${{ steps.lastCommit.outputs.sha1 }} | ./scripts/update-compat-data/bump-data-compat-version.sh + - name: Run update script + run: make build-compat-data + - name: Commit changes + run: | + git config user.name "Babel Bot" + git config user.email "babel-bot@users.noreply.github.com" + git checkout -b update-compat-data + git commit -am "chore: update compat data to ${{ steps.lastCommit.outputs.sha1 }}" + git push --force origin update-compat-data + - name: Create Pull Request + uses: actions/github-script@v4 + with: + github-token: ${{ secrets.BOT_TOKEN }} + script: | + const base = process.env.GITHUB_REF.replace("refs/heads/", ""); + const requestParam = { + owner: context.repo.owner, + repo: context.repo.repo, + head: context.repo.owner + ":update-compat-data", + base: base, + state: "open" + }; + const result = await github.pulls.list(requestParam); + console.log("Open PR request: ", requestParam); + console.log("Open PR response: ", result); + const prs = result.data; + if (prs.length === 0) { + const requestParam = { + owner: context.repo.owner, + repo: context.repo.repo, + head: "update-compat-data", + base: base, + maintainer_can_modify: true, + title: "Update compat data", + body: "Update compat data to [${{ steps.lastCommit.outputs.sha1 }}](https://github.com/kangax/compat-table/commit/${{ steps.lastCommit.outputs.sha1 }}).", + }; + const result = await github.pulls.create(requestParam); + console.log("Create PR request: ", requestParam) + console.log("Create PR response: ", result); + + github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: result.data.number, + labels: ["area: compat-data", "repo automation :robot:"] + }) + } + + diff --git a/scripts/update-compat-data/bump-data-compat-version.sh b/scripts/update-compat-data/bump-data-compat-version.sh new file mode 100644 index 000000000000..7635f4f11280 --- /dev/null +++ b/scripts/update-compat-data/bump-data-compat-version.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# read given commit SHA1 from stdin, update to COMPAT_TABLE_COMMIT in download-compat-table.sh +# usage: +# node ./scripts/update-compat-data/get-last-commit.js | sh ./scripts/update-compat-data/bump-data-compat-version.sh + +set -e +perl -i -pe 's/^COMPAT_TABLE_COMMIT.+$/COMPAT_TABLE_COMMIT='$(cat)'/' ./packages/babel-compat-data/download-compat-table.sh diff --git a/scripts/update-compat-data/compare-with-current-commit.js b/scripts/update-compat-data/compare-with-current-commit.js new file mode 100644 index 000000000000..6d95512fa7a2 --- /dev/null +++ b/scripts/update-compat-data/compare-with-current-commit.js @@ -0,0 +1,49 @@ +import { readFile } from "fs/promises"; +import path from "path"; +import { fileURLToPath } from "url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const CURRENT_COMMIT_VARIABLE_NAME = "COMPAT_TABLE_COMMIT"; + +async function getCurrentCommit() { + const target = path.join( + __dirname, + "..", + "..", + "packages", + "babel-compat-data", + "scripts", + "download-compat-table.sh" + ); + const lines = (await readFile(target, { encoding: "utf-8" })).split("\n"); + + for (const line of lines) { + if (line.includes(CURRENT_COMMIT_VARIABLE_NAME)) { + return line.split("=").at(1); + } + } + + return undefined; +} + +async function checkCurrentCommit(lastCommit) { + if (typeof lastCommit !== "string") { + throw new Error(`Last commit should be provided but got ${lastCommit}`); + } + + const currentCommit = await getCurrentCommit(); + if (typeof lastCommit !== "string") { + throw new Error("Not valid current commit found: ${currentCommit}"); + } + + console.log("last commit :", lastCommit); + console.log("current commit :", currentCommit); + + if (lastCommit === currentCommit) { + throw new Error("compat-data doesn't need to be updated"); + } + + return lastCommit; +} + +checkCurrentCommit(process.argv[2]).then(console.log); diff --git a/scripts/update-compat-data/get-last-commit.sh b/scripts/update-compat-data/get-last-commit.sh new file mode 100644 index 000000000000..1aec89303996 --- /dev/null +++ b/scripts/update-compat-data/get-last-commit.sh @@ -0,0 +1,4 @@ + set -e + export GIT_DIR=./packages/babel-compat-data/build/compat-table + git fetch -q origin HEAD + git rev-parse FETCH_HEAD From 4a58c224a236c9baa711a40412fb0319ede92d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 15:56:26 +0200 Subject: [PATCH 02/16] Use babel/actions/create-pull-request --- .github/workflows/update-compat-data.yml | 46 ++++----------------- .github/workflows/update-parser-tests.yml | 49 ++++++----------------- 2 files changed, 20 insertions(+), 75 deletions(-) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 9e68a4dd3371..9d231290404c 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -37,42 +37,12 @@ jobs: git commit -am "chore: update compat data to ${{ steps.lastCommit.outputs.sha1 }}" git push --force origin update-compat-data - name: Create Pull Request - uses: actions/github-script@v4 + uses: babel/actions/create-pull-request@v2 with: - github-token: ${{ secrets.BOT_TOKEN }} - script: | - const base = process.env.GITHUB_REF.replace("refs/heads/", ""); - const requestParam = { - owner: context.repo.owner, - repo: context.repo.repo, - head: context.repo.owner + ":update-compat-data", - base: base, - state: "open" - }; - const result = await github.pulls.list(requestParam); - console.log("Open PR request: ", requestParam); - console.log("Open PR response: ", result); - const prs = result.data; - if (prs.length === 0) { - const requestParam = { - owner: context.repo.owner, - repo: context.repo.repo, - head: "update-compat-data", - base: base, - maintainer_can_modify: true, - title: "Update compat data", - body: "Update compat data to [${{ steps.lastCommit.outputs.sha1 }}](https://github.com/kangax/compat-table/commit/${{ steps.lastCommit.outputs.sha1 }}).", - }; - const result = await github.pulls.create(requestParam); - console.log("Create PR request: ", requestParam) - console.log("Create PR response: ", result); - - github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: result.data.number, - labels: ["area: compat-data", "repo automation :robot:"] - }) - } - - + token: ${{ secrets.BOT_TOKEN }} + branch: update-compat-data + title: Update compat data + description: Update compat data to [${{ steps.lastCommit.outputs.sha1 }}](https://github.com/kangax/compat-table/commit/${{ steps.lastCommit.outputs.sha1 }}). + labels: | + area: compat-data + repo automation :robot: diff --git a/.github/workflows/update-parser-tests.yml b/.github/workflows/update-parser-tests.yml index 960aa4ab55a8..1fb0ff38ccbc 100644 --- a/.github/workflows/update-parser-tests.yml +++ b/.github/workflows/update-parser-tests.yml @@ -13,7 +13,7 @@ permissions: jobs: createPullRequest: permissions: - contents: write # for Git to git push + contents: write # for Git to git push runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -47,40 +47,15 @@ jobs: git commit -am "chore: update test262 to ${{ steps.test262.outputs.sha1 }}" git push --force origin update-test262-parser - name: Create Pull Request - uses: actions/github-script@v4 + uses: babel/actions/create-pull-request@v2 with: - github-token: ${{ secrets.BOT_TOKEN }} - script: | - const base = process.env.GITHUB_REF.replace("refs/heads/", ""); - const requestParam = { - owner: context.repo.owner, - repo: context.repo.repo, - head: context.repo.owner + ":update-test262-parser", - base: base, - state: "open" - }; - const result = await github.pulls.list(requestParam); - console.log("Open PR request: ", requestParam); - console.log("Open PR response: ", result); - const prs = result.data; - if (prs.length === 0) { - const requestParam = { - owner: context.repo.owner, - repo: context.repo.repo, - head: "update-test262-parser", - base: base, - maintainer_can_modify: true, - title: "Update test262", - body: "Update test262 to [${{ steps.test262.outputs.sha1 }}](https://github.com/tc39/test262/commit/${{ steps.test262.outputs.sha1 }}).", - }; - const result = await github.pulls.create(requestParam); - console.log("Create PR request: ", requestParam) - console.log("Create PR response: ", result); - - github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: result.data.number, - labels: ["area: test262", "repo automation :robot:"] - }) - } + token: ${{ secrets.BOT_TOKEN }} + branch: update-test262-parser + commit-user: Babel Bot + commit-email: babel-bot@users.noreply.github.com + commit-title: chore: update test262 to ${{ steps.test262.outputs.sha1 }} + pr-title: Update test262 + pr-description: Update test262 to [${{ steps.test262.outputs.sha1 }}](https://github.com/tc39/test262/commit/${{ steps.test262.outputs.sha1 }}). + pr-labels: | + area: test262 + repo automation :robot: From 5d2883601b445d5a7bfd8f31de80ff8b9d58480b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:00:15 +0200 Subject: [PATCH 03/16] Update sh scripts --- scripts/update-compat-data/bump-data-compat-version.sh | 4 ++-- scripts/update-compat-data/get-last-commit.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 scripts/update-compat-data/bump-data-compat-version.sh mode change 100644 => 100755 scripts/update-compat-data/get-last-commit.sh diff --git a/scripts/update-compat-data/bump-data-compat-version.sh b/scripts/update-compat-data/bump-data-compat-version.sh old mode 100644 new mode 100755 index 7635f4f11280..9607a502a19d --- a/scripts/update-compat-data/bump-data-compat-version.sh +++ b/scripts/update-compat-data/bump-data-compat-version.sh @@ -1,7 +1,7 @@ #!/bin/sh # read given commit SHA1 from stdin, update to COMPAT_TABLE_COMMIT in download-compat-table.sh # usage: -# node ./scripts/update-compat-data/get-last-commit.js | sh ./scripts/update-compat-data/bump-data-compat-version.sh +# ./scripts/update-compat-data/get-last-commit.sh | ./scripts/update-compat-data/bump-data-compat-version.sh set -e -perl -i -pe 's/^COMPAT_TABLE_COMMIT.+$/COMPAT_TABLE_COMMIT='$(cat)'/' ./packages/babel-compat-data/download-compat-table.sh +perl -i -pe 's/^COMPAT_TABLE_COMMIT.+$/COMPAT_TABLE_COMMIT='$(cat)'/' ./packages/babel-compat-data/scripts/download-compat-table.sh diff --git a/scripts/update-compat-data/get-last-commit.sh b/scripts/update-compat-data/get-last-commit.sh old mode 100644 new mode 100755 index 1aec89303996..5f54f29c75e8 --- a/scripts/update-compat-data/get-last-commit.sh +++ b/scripts/update-compat-data/get-last-commit.sh @@ -1,4 +1,4 @@ - set -e - export GIT_DIR=./packages/babel-compat-data/build/compat-table - git fetch -q origin HEAD - git rev-parse FETCH_HEAD +set -e +GIT_DIR=./packages/babel-compat-data/build/compat-table +git fetch -q origin HEAD +git rev-parse FETCH_HEAD From 4554da099466e294a814dbe42eb32056d57911ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:15:07 +0200 Subject: [PATCH 04/16] Remove unnecessary js script --- .github/workflows/update-compat-data.yml | 11 ++++- .../compare-with-current-commit.js | 49 ------------------- 2 files changed, 9 insertions(+), 51 deletions(-) delete mode 100644 scripts/update-compat-data/compare-with-current-commit.js diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 9d231290404c..22d976d4688c 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -23,13 +23,19 @@ jobs: - name: Get latest kangax/compat-data commit id: lastCommit run: echo "::set-output name=sha1::$(node ./scripts/update-compat-data/get-last-commit.sh)" - - name: Compare last kangax/compat-data commit with current one - run: echo ${{ steps.lastCommit.outputs.sha1 }} | node ./scripts/update-compat-data/compare-with-current-commit.js - name: Update compat-data commit run: echo ${{ steps.lastCommit.outputs.sha1 }} | ./scripts/update-compat-data/bump-data-compat-version.sh + - name: Check if it has been updated + run: | + [[ -z $(git status -s) ]] && + echo "::set-output name=updated::false" || + echo "::set-output name=updated::true" + id: updated - name: Run update script + if: steps.updated.outputs.updated == 'true' run: make build-compat-data - name: Commit changes + if: steps.updated.outputs.updated == 'true' run: | git config user.name "Babel Bot" git config user.email "babel-bot@users.noreply.github.com" @@ -37,6 +43,7 @@ jobs: git commit -am "chore: update compat data to ${{ steps.lastCommit.outputs.sha1 }}" git push --force origin update-compat-data - name: Create Pull Request + if: steps.updated.outputs.updated == 'true' uses: babel/actions/create-pull-request@v2 with: token: ${{ secrets.BOT_TOKEN }} diff --git a/scripts/update-compat-data/compare-with-current-commit.js b/scripts/update-compat-data/compare-with-current-commit.js deleted file mode 100644 index 6d95512fa7a2..000000000000 --- a/scripts/update-compat-data/compare-with-current-commit.js +++ /dev/null @@ -1,49 +0,0 @@ -import { readFile } from "fs/promises"; -import path from "path"; -import { fileURLToPath } from "url"; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const CURRENT_COMMIT_VARIABLE_NAME = "COMPAT_TABLE_COMMIT"; - -async function getCurrentCommit() { - const target = path.join( - __dirname, - "..", - "..", - "packages", - "babel-compat-data", - "scripts", - "download-compat-table.sh" - ); - const lines = (await readFile(target, { encoding: "utf-8" })).split("\n"); - - for (const line of lines) { - if (line.includes(CURRENT_COMMIT_VARIABLE_NAME)) { - return line.split("=").at(1); - } - } - - return undefined; -} - -async function checkCurrentCommit(lastCommit) { - if (typeof lastCommit !== "string") { - throw new Error(`Last commit should be provided but got ${lastCommit}`); - } - - const currentCommit = await getCurrentCommit(); - if (typeof lastCommit !== "string") { - throw new Error("Not valid current commit found: ${currentCommit}"); - } - - console.log("last commit :", lastCommit); - console.log("current commit :", currentCommit); - - if (lastCommit === currentCommit) { - throw new Error("compat-data doesn't need to be updated"); - } - - return lastCommit; -} - -checkCurrentCommit(process.argv[2]).then(console.log); From 19a760ee1bc6995363f5c75335ddba61cc1e4f8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:20:40 +0200 Subject: [PATCH 05/16] Updates --- .github/workflows/update-compat-data.yml | 15 +++++++++++++++ .github/workflows/update-parser-tests.yml | 1 + 2 files changed, 16 insertions(+) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 22d976d4688c..ee1dcf1bab98 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -9,6 +9,7 @@ on: jobs: createPullRequest: + name: Update compat-table runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -31,9 +32,23 @@ jobs: echo "::set-output name=updated::false" || echo "::set-output name=updated::true" id: updated + - name: Bootstrap + if: steps.updated.outputs.updated == 'true' + run: make bootstrap - name: Run update script if: steps.updated.outputs.updated == 'true' run: make build-compat-data + - name: Update tests + if: steps.updated.outputs.updated == 'true' + run: yarn jest + env: + OVERWRITE: true + - name: Update tests (Babel 8) + if: steps.updated.outputs.updated == 'true' + run: yarn jest + env: + OVERWRITE: true + BABEL_8_BREAKING: true - name: Commit changes if: steps.updated.outputs.updated == 'true' run: | diff --git a/.github/workflows/update-parser-tests.yml b/.github/workflows/update-parser-tests.yml index 1fb0ff38ccbc..23ae2154d8dd 100644 --- a/.github/workflows/update-parser-tests.yml +++ b/.github/workflows/update-parser-tests.yml @@ -12,6 +12,7 @@ permissions: jobs: createPullRequest: + name: Update parser test262 tests permissions: contents: write # for Git to git push runs-on: ubuntu-latest From 7d824f4355faed07f33b195288e96f7ba8d84427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:29:11 +0200 Subject: [PATCH 06/16] Rename --- .github/workflows/update-compat-data.yml | 8 ++++---- .../bump-compat-table-commit.sh} | 2 +- .../get-last-commit.sh | 0 3 files changed, 5 insertions(+), 5 deletions(-) rename scripts/{update-compat-data/bump-data-compat-version.sh => update-compat-table/bump-compat-table-commit.sh} (69%) rename scripts/{update-compat-data => update-compat-table}/get-last-commit.sh (100%) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index ee1dcf1bab98..80496451e00f 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -21,11 +21,11 @@ jobs: uses: actions/setup-node@v2-beta with: node-version: "*" - - name: Get latest kangax/compat-data commit + - name: Get latest kangax/compat-table commit id: lastCommit - run: echo "::set-output name=sha1::$(node ./scripts/update-compat-data/get-last-commit.sh)" - - name: Update compat-data commit - run: echo ${{ steps.lastCommit.outputs.sha1 }} | ./scripts/update-compat-data/bump-data-compat-version.sh + run: echo "::set-output name=sha1::$(node ./scripts/update-compat-table/get-last-commit.sh)" + - name: Update compat-table commit + run: echo ${{ steps.lastCommit.outputs.sha1 }} | ./scripts/update-compat-table/bump-compat-table-commit.sh - name: Check if it has been updated run: | [[ -z $(git status -s) ]] && diff --git a/scripts/update-compat-data/bump-data-compat-version.sh b/scripts/update-compat-table/bump-compat-table-commit.sh similarity index 69% rename from scripts/update-compat-data/bump-data-compat-version.sh rename to scripts/update-compat-table/bump-compat-table-commit.sh index 9607a502a19d..3a83f07efb02 100755 --- a/scripts/update-compat-data/bump-data-compat-version.sh +++ b/scripts/update-compat-table/bump-compat-table-commit.sh @@ -1,7 +1,7 @@ #!/bin/sh # read given commit SHA1 from stdin, update to COMPAT_TABLE_COMMIT in download-compat-table.sh # usage: -# ./scripts/update-compat-data/get-last-commit.sh | ./scripts/update-compat-data/bump-data-compat-version.sh +# ./scripts/update-compat-table/get-last-commit.sh | ./scripts/update-compat-table/bump-data-compat-version.sh set -e perl -i -pe 's/^COMPAT_TABLE_COMMIT.+$/COMPAT_TABLE_COMMIT='$(cat)'/' ./packages/babel-compat-data/scripts/download-compat-table.sh diff --git a/scripts/update-compat-data/get-last-commit.sh b/scripts/update-compat-table/get-last-commit.sh similarity index 100% rename from scripts/update-compat-data/get-last-commit.sh rename to scripts/update-compat-table/get-last-commit.sh From 13d996c566caf37d9325d2b1845c464941422250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:31:36 +0200 Subject: [PATCH 07/16] continue-on-error tests --- .github/workflows/update-compat-data.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 80496451e00f..803ea75891a0 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -40,11 +40,13 @@ jobs: run: make build-compat-data - name: Update tests if: steps.updated.outputs.updated == 'true' + continue-on-error: true run: yarn jest env: OVERWRITE: true - name: Update tests (Babel 8) if: steps.updated.outputs.updated == 'true' + continue-on-error: true run: yarn jest env: OVERWRITE: true From 2ed33021cb6732c5e347710ab2f295e1a2e40ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:33:05 +0200 Subject: [PATCH 08/16] Add fetch-depth Co-authored-by: Armano --- .github/workflows/update-compat-data.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 803ea75891a0..8d5480723a6d 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -17,6 +17,7 @@ jobs: with: repository: kangax/compat-table path: packages/babel-compat-data/build/compat-table + fetch-depth: 2 - name: Use Node.js latest uses: actions/setup-node@v2-beta with: From 3353e94af1eb3747c22b640f9fe755b3d66f5fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:34:48 +0200 Subject: [PATCH 09/16] Update scripts/update-compat-table/bump-compat-table-commit.sh --- scripts/update-compat-table/bump-compat-table-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-compat-table/bump-compat-table-commit.sh b/scripts/update-compat-table/bump-compat-table-commit.sh index 3a83f07efb02..29209287c525 100755 --- a/scripts/update-compat-table/bump-compat-table-commit.sh +++ b/scripts/update-compat-table/bump-compat-table-commit.sh @@ -1,7 +1,7 @@ #!/bin/sh # read given commit SHA1 from stdin, update to COMPAT_TABLE_COMMIT in download-compat-table.sh # usage: -# ./scripts/update-compat-table/get-last-commit.sh | ./scripts/update-compat-table/bump-data-compat-version.sh +# ./scripts/update-compat-table/get-last-commit.sh | ./scripts/update-compat-table/bump-compat-table-commit.sh set -e perl -i -pe 's/^COMPAT_TABLE_COMMIT.+$/COMPAT_TABLE_COMMIT='$(cat)'/' ./packages/babel-compat-data/scripts/download-compat-table.sh From 86a0f415ef27891a1763308829a19be8351516cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:35:30 +0200 Subject: [PATCH 10/16] Fix --- .github/workflows/update-compat-data.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 8d5480723a6d..bf16d7450ad9 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -24,7 +24,7 @@ jobs: node-version: "*" - name: Get latest kangax/compat-table commit id: lastCommit - run: echo "::set-output name=sha1::$(node ./scripts/update-compat-table/get-last-commit.sh)" + run: echo "::set-output name=sha1::$(./scripts/update-compat-table/get-last-commit.sh)" - name: Update compat-table commit run: echo ${{ steps.lastCommit.outputs.sha1 }} | ./scripts/update-compat-table/bump-compat-table-commit.sh - name: Check if it has been updated From 21f7059f0d684405f7d6afbd5990b77df83c9479 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:39:05 +0200 Subject: [PATCH 11/16] Add back `export` --- scripts/update-compat-table/get-last-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-compat-table/get-last-commit.sh b/scripts/update-compat-table/get-last-commit.sh index 5f54f29c75e8..daed1582b9ce 100755 --- a/scripts/update-compat-table/get-last-commit.sh +++ b/scripts/update-compat-table/get-last-commit.sh @@ -1,4 +1,4 @@ set -e -GIT_DIR=./packages/babel-compat-data/build/compat-table +export GIT_DIR=./packages/babel-compat-data/build/compat-table git fetch -q origin HEAD git rev-parse FETCH_HEAD From 93724bfbeb59f8f13ae17bb90491d90a328d301b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:42:03 +0200 Subject: [PATCH 12/16] Fix git --- scripts/update-compat-table/get-last-commit.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/update-compat-table/get-last-commit.sh b/scripts/update-compat-table/get-last-commit.sh index daed1582b9ce..3ad689d9a719 100755 --- a/scripts/update-compat-table/get-last-commit.sh +++ b/scripts/update-compat-table/get-last-commit.sh @@ -1,4 +1,4 @@ set -e -export GIT_DIR=./packages/babel-compat-data/build/compat-table +cd ./packages/babel-compat-data/build/compat-table git fetch -q origin HEAD git rev-parse FETCH_HEAD From d20c95707d1fa5b3cdba6c1eb9bdd860296d6b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:47:39 +0200 Subject: [PATCH 13/16] Update checkout action --- .github/workflows/update-compat-data.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index bf16d7450ad9..a0f329e59a3b 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -12,12 +12,11 @@ jobs: name: Update compat-table runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - uses: actions/checkout@v3 with: repository: kangax/compat-table path: packages/babel-compat-data/build/compat-table - fetch-depth: 2 - name: Use Node.js latest uses: actions/setup-node@v2-beta with: From 047ef4ce7fdd5baed813c89980b9945cb33dccc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 16:56:44 +0200 Subject: [PATCH 14/16] Fix permissions --- .github/workflows/update-compat-data.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index a0f329e59a3b..26ecabb29d7b 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -53,6 +53,8 @@ jobs: BABEL_8_BREAKING: true - name: Commit changes if: steps.updated.outputs.updated == 'true' + permissions: + contents: write # for Git to git push run: | git config user.name "Babel Bot" git config user.email "babel-bot@users.noreply.github.com" From c6c3807d4093a0636071227314d310247b8aa9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 17:06:34 +0200 Subject: [PATCH 15/16] Fix --- .github/workflows/update-compat-data.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-compat-data.yml b/.github/workflows/update-compat-data.yml index 26ecabb29d7b..73582e81b566 100644 --- a/.github/workflows/update-compat-data.yml +++ b/.github/workflows/update-compat-data.yml @@ -11,6 +11,8 @@ jobs: createPullRequest: name: Update compat-table runs-on: ubuntu-latest + permissions: + contents: write # for Git to git push steps: - uses: actions/checkout@v3 - uses: actions/checkout@v3 @@ -53,8 +55,6 @@ jobs: BABEL_8_BREAKING: true - name: Commit changes if: steps.updated.outputs.updated == 'true' - permissions: - contents: write # for Git to git push run: | git config user.name "Babel Bot" git config user.email "babel-bot@users.noreply.github.com" From 521c42f6becfa0b0e38e0d31aeebe93eb7a5df9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Wed, 1 Jun 2022 17:28:07 +0200 Subject: [PATCH 16/16] Small revert --- .github/workflows/update-parser-tests.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/update-parser-tests.yml b/.github/workflows/update-parser-tests.yml index 23ae2154d8dd..f4c00010f907 100644 --- a/.github/workflows/update-parser-tests.yml +++ b/.github/workflows/update-parser-tests.yml @@ -52,11 +52,8 @@ jobs: with: token: ${{ secrets.BOT_TOKEN }} branch: update-test262-parser - commit-user: Babel Bot - commit-email: babel-bot@users.noreply.github.com - commit-title: chore: update test262 to ${{ steps.test262.outputs.sha1 }} - pr-title: Update test262 - pr-description: Update test262 to [${{ steps.test262.outputs.sha1 }}](https://github.com/tc39/test262/commit/${{ steps.test262.outputs.sha1 }}). - pr-labels: | + title: Update test262 + description: Update test262 to [${{ steps.test262.outputs.sha1 }}](https://github.com/tc39/test262/commit/${{ steps.test262.outputs.sha1 }}). + labels: | area: test262 repo automation :robot: