Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: automate compat-data update (#14248)
Co-authored-by: Armano <armano2@users.noreply.github.com> Co-authored-by: Nicol貌 Ribaudo <nicolo.ribaudo@gmail.com>
- Loading branch information
1 parent
dd75b02
commit d0108c0
Showing
4 changed files
with
95 additions
and
37 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Update compat data | ||
env: | ||
YARN_ENABLE_SCRIPTS: false # disable post-install scripts | ||
on: | ||
workflow_dispatch: | ||
inputs: {} | ||
schedule: | ||
- cron: "0 0 * * 5" | ||
|
||
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 | ||
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-table commit | ||
id: lastCommit | ||
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 | ||
run: | | ||
[[ -z $(git status -s) ]] && | ||
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' | ||
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 | ||
BABEL_8_BREAKING: true | ||
- 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" | ||
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 | ||
if: steps.updated.outputs.updated == 'true' | ||
uses: babel/actions/create-pull-request@v2 | ||
with: | ||
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: |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +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-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 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set -e | ||
cd ./packages/babel-compat-data/build/compat-table | ||
git fetch -q origin HEAD | ||
git rev-parse FETCH_HEAD |