Skip to content

Conversation

@ckipp01
Copy link
Collaborator

@ckipp01 ckipp01 commented Jan 15, 2023

I was about to sync and send in a pr again, but I figured why not just automate this. This change adds a new CI job that will run every morning and detect if there are changes. If so, it will commit them and send in a pr.

- name: Commit changes if necessary
if: steps.check-for-changes.outputs.files_changed == 'true'
run: |
git config user.name "GitHub"
Copy link
Collaborator

Choose a reason for hiding this comment

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

So github just provides an account you can use to do things like these?
Wild if so - I'm tempted to just merge this and run it manually to see if it works!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Seems so, I took a lot of this from the way nvim-treesitter does this for their lock file.

uses: peter-evans/create-pull-request@v4
with:
title: "chore: generate and sync latest changes"
branch: generation
Copy link
Collaborator

Choose a reason for hiding this comment

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

where are you git checkout -b this branch? or does this GHA do it for you?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So I think technically we just commit it to master, but then the next step in create-pull-request specifies the branch. I think it must just take those changes, create a new branch, and then create the pr. Sort of copying this part from https://github.com/nvim-treesitter/nvim-treesitter/blob/5e9c6b6ba079a90a2545e651e3740b655b9ff035/.github/workflows/update-lockfile.yml#L40-L56.

Copy link
Collaborator

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks @ckipp01!

@ckipp01
Copy link
Collaborator Author

ckipp01 commented Jan 15, 2023

Alright, I'm gonna merge and we'll try it out. I fully expect something to not work right, but we'll see 😄

@ckipp01 ckipp01 merged commit e5979c5 into tree-sitter:master Jan 15, 2023
@ckipp01 ckipp01 deleted the sync branch January 15, 2023 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants