Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: automate compat-data update #14248

Merged
merged 16 commits into from Jun 1, 2022

Conversation

tony-go
Copy link
Contributor

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

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
Copy link
Collaborator

babel-bot commented Feb 10, 2022

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

@tony-go
Copy link
Contributor Author

tony-go commented Feb 10, 2022

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
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
Contributor 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
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
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
Contributor 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 ^^

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
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
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
Copy link
Member

nicolo-ribaudo commented Jun 1, 2022

@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.

None yet

6 participants