Skip to content

Conversation

@robertbrignull
Copy link
Contributor

@robertbrignull robertbrignull commented Jun 12, 2020

Adds a script to create a PR once per week to update the v1 release branch.

See https://github.com/Anthophila/robertbrignull-update-automation/pull/19 for an example of what it looks like.

We can also try running it on this repo before merging it. I've added a repository_dispatch trigger so it can be run on demand as well as on a schedule.

Merge / deployment checklist

  • Run test builds as necessary. Can be on this repository or elsewhere as needed in order to test the change - please include links to tests in other repos!
    • CodeQL using init/analyze actions
    • 3rd party tool using upload action
  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.

@robertbrignull
Copy link
Contributor Author

I thought we could test this out on this repository before merging it, but turns out repository dispatch events only run on the master branch. You can see the runs on the demo repository so hopefully that and a manual review are enough.

If there are any thoughts on improvements to the message of the PR feel free to bring those up too. Though things like that we can easily change after this is merged and in use.

Another thing is there are a couple of places where the error checking is perhaps not the greatest. For instance when getting the commit author login it might not be a user with a github account and I don't know what happens in this case. Since this is an internal tool I'd personally be happy to just leave it as it is and if it breaks in the future on an edge case then we'll fix it then. 🤷

@robertbrignull
Copy link
Contributor Author

The PyGithub library was just one I found. I have no idea if it's the best one to use, but it seems to be pretty up to date. To understand what stuff in that library is doing I found it easiest to just look directly at the code, e.g. https://github.com/PyGithub/PyGithub/blob/master/github/PullRequest.py

Copy link
Contributor

@alexkappa alexkappa left a comment

Choose a reason for hiding this comment

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

I can't comment on the script itself as I'm not competent enough in Python but this LGTM.

Some thoughts on future improvements:

  • We could extract this into its own repo/action (e.g. github/release-branch-action?).
  • Given ☝️ we could write it in js/ts, that way I might be able to contribute if needed.
  • Script a hubot command to trigger repository_dispatch if more control is needed than what a cron job provides (me and @robertbrignull talked about this during our pairing this morning).

@robertbrignull
Copy link
Contributor Author

Those sound like good improvements to me. Hopefully we won't have to trigger it ondemand too often but being able to do so without having to make the API request manually would be nice.

I picked python for the script only out of personal preference as it's quite lightweight and I wasn't really thinking about how it integrates with the existing code in this action. I wouldn't oppose rewriting it in something else if that would be beneficial, however I also think it's still worth merging this as it is.

Also since this is a script that is only run from an internal dev action and has no chance of breaking the main action I see no problem with merging it now. Let's just merge this and wait for it to run on Monday morning. It's been tested on another repo so I have confidence it'll work on this repo just fine. If it does break then fixing on Monday will be fine.

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