Visitar URL original
chore: automate compat-data update by tony-go · Pull Request #14248 · babel/babel · GitHub
Skip to content

chore: automate compat-data update - #14248

Merged
nicolo-ribaudo merged 16 commits into
babel:mainfrom
tony-go:auto-compat-data-update
Jun 1, 2022
Merged

nicolo-ribaudo merged 16 commits into
babel:mainfrom
tony-go:auto-compat-data-update

Conversation

@tony-go

@tony-go tony-go commented Feb 7, 2022 •

Copy link
Copy Markdown

Hi 👋

This pull request tends to automate compat-data update.

Q                       A
Fixed Issues? #14138
Patch: Bug Fix? 👎
Major: Breaking Change? 👎
Minor: New Feature? 👎
Tests Added + Pass? 👎
Documentation PR Link 👎
Any Dependency Changes? 👍
License MIT

@JLHwung shows me the Test262 automation as a model for this one:

  • Fetch the last commit
  • If different from the current then execute the rest
  • Update the commit sha in the ./packages/babel-compat-data/download-compat-table.sh
  • Commit changes
  • Create a pull request

A word about testing: nothing in the scripts folder was tested. I'd like to create a sub-folder test and add a test for the js script. WDYT?

@babel-bot

babel-bot commented Feb 10, 2022 •

Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/52125/

@tony-go

tony-go commented Feb 10, 2022

Copy link
Copy Markdown
Author

Hi there 👋

I finally use the action/checkout to get the last commit from kangax repo.

I add a compare script to check if it's relevant to update or not. If commits are equal it throws.

To wrap up:

  • I get the last commit from kangax repository
  • I compare it with the current we have
  • If it's okay, I update the bump-data-compat-version.sh script
  • Then I run it.

cc @JLHwung

- 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we need this step; we don't have it for the parser tests updater.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback @nicolo-ribaudo 🙌 :)

My initial was to avoid useless computations, doesn't that make sense?

set -e
export GIT_DIR=./packages/babel-compat-data/build/compat-table
git fetch -q origin HEAD
git rev-parse FETCH_HEAD

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this script and bump-data-compat-version.sh are not used anywhere else, we could just inline them in the action as a single step:

      - name: Update to latest kangax/compat-data commit
        run: perl -i -pe 's/^COMPAT_TABLE_COMMIT.+$/COMPAT_TABLE_COMMIT='$(git rev-parse FETCH_HEAD)'/' ./packages/babel-compat-data/download-compat-table.sh
        with:
          GIT_DIR: ./packages/babel-compat-data/build/compat-table

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is good to leave it as-is: It is more convenient to debug the update workflow in local machine.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with the bot approach here ^^

@nicolo-ribaudo
nicolo-ribaudo force-pushed the auto-compat-data-update branch from 1246873 to 4a58c22 Compare June 1, 2022 13:56
@nicolo-ribaudo
nicolo-ribaudo force-pushed the auto-compat-data-update branch from c11c42f to 8997ec2 Compare June 1, 2022 14:23
@nicolo-ribaudo
nicolo-ribaudo force-pushed the auto-compat-data-update branch from 8997ec2 to 19a760e Compare June 1, 2022 14:24
@nicolo-ribaudo
nicolo-ribaudo force-pushed the auto-compat-data-update branch from b28a485 to 13d996c Compare June 1, 2022 14:31
Co-authored-by: Armano <armano2@users.noreply.github.com>
@nicolo-ribaudo nicolo-ribaudo added PR: Internal 🏠 A type of pull request used for our changelog categories repo automation 🤖 labels Jun 1, 2022
@nicolo-ribaudo

Copy link
Copy Markdown
Member

This works!

Action run: https://github.com/nicolo-ribaudo/babel/runs/6692355681
PR: nicolo-ribaudo#5

@nicolo-ribaudo
nicolo-ribaudo marked this pull request as ready for review June 1, 2022 15:25
@nicolo-ribaudo

Copy link
Copy Markdown
Member

I'm merging this to test if it also works in this repo, or if there are any permissions problems.

@nicolo-ribaudo nicolo-ribaudo changed the title chore: automate compat-data update chore: automate compat-data update Jun 1, 2022
@nicolo-ribaudo
nicolo-ribaudo merged commit d0108c0 into babel:main Jun 1, 2022
@nicolo-ribaudo

nicolo-ribaudo commented Jun 1, 2022 •

Copy link
Copy Markdown
Member

@liuxingbaoyu liuxingbaoyu mentioned this pull request Sep 1, 2022
1 task done
@github-actions github-actions Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Sep 1, 2022
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories repo automation 🤖

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants