xia2 / screen19

Screening program for small-molecule single-crystal X-ray diffraction data
https://pypi.org/project/screen19/
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

Automate pre-commit hook updates #34

Closed benjaminhwilliams closed 4 years ago

benjaminhwilliams commented 4 years ago

Write a GitHub action to periodically do the following:

  1. Check out the module.
  2. Set up Python.
  3. Run pip install pre-commit.
  4. Run pre-commit autoupdate.
  5. Run pre-commit run --all-files.
  6. If the branch pre-commit-autoupdate exists, merge master into this branch (or should we delete it, along with any associated open PR, and branch again from the current state of master?). Otherwise, make that branch and check it out.
  7. Commit the changes.
  8. If there isn't already one, open a pull request and commit a corresponding pro forma Towncrier .misc news fragment.
  9. If the only changes are contained in .pre-commit-config.yaml (i.e. version number changes) and the news fragment, then merge?

Some further refinements to that workflow are probably necessary.

Anthchirp commented 4 years ago
  1. If the branch pre-commit-autoupdate exists, merge master into this branch (or should we delete it, along with any associated open PR, and branch again from the current state of master?). Otherwise, make that branch and check it out.

Suggest delete, ie. just create a new one off HEAD and force-push.

  1. If the only changes are contained in .pre-commit-config.yaml (i.e. version number changes) and the news fragment, then merge?

I would leave auto-merging as out of scope. You want to merge only when tests pass anyway, but you don't want to monitor this from the PR-creating action.

benjaminhwilliams commented 4 years ago

Good points, thanks.

benjaminhwilliams commented 4 years ago

Workflow now more like:

  1. Check out the module.
  2. Set up Python.
  3. Run pip install pre-commit.
  4. Run pre-commit autoupdate.
  5. Run pre-commit run --all-files.
  6. Run git checkout -B pre-commit-autoupdate.
  7. Commit the changes.
  8. Force-push the commit.
  9. If there isn't already one, open a pull request and commit & push a corresponding pro forma Towncrier .misc news fragment.
benjaminhwilliams commented 4 years ago

Useful inspiration here: https://dev.to/browniebroke/auto-update-pre-commit-hooks-with-github-actions-3f84