tzdata
tzdata copied to clipboard
Automated PR bot
We should create an automated PR bot that watches for releases and makes a PR automatically if it detects a change.
I can see two fairly simple ways of doing this:
- Run
tox -e updateand see ifgit diffshows any substantive change (depending on how #5 is resolvedupdate.pymay end up "resetting" all non-IANA version components even if the version hasn't changed). - Change
update.pyto store a hash of the most recent tarball(s) somewhere in the repository and generate a PR whenever that changes.
I think the biggest challenge is preventing it from generating multiple PRs if it is triggered more than once before the first one is merged, which requires maintaining some state somewhere. Possibly that's easy enough to do because presumably the bot needs its own fork of the repository (or a branch on the main repository), and if the branch name is the same as the IANA version we can just not create the PR if the branch exists.
I think the biggest challenge is preventing it from generating multiple PRs if it is triggered more than once before the first one is merged, which requires maintaining some state somewhere.
The https://github.com/peter-evans/create-pull-request GitHub Action can handle this:
If a pull request already exists it will be updated if necessary. Local changes in the Actions workspace, or changes on the base branch, can cause an update. If no update is required the action exits silently.