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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template updates as bot PRs #27

Open
brynpickering opened this issue Mar 28, 2024 · 0 comments
Open

Template updates as bot PRs #27

brynpickering opened this issue Mar 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@brynpickering
Copy link
Collaborator

What can be improved?

As raised in arup-group/genet#234 it's probably nicer to have the cruft template check and update done in a separate workflow and automatically raised as a new PR.

There's a dependency manager that might be updated with a bot to solve this issue for us: renovatebot/renovate#24000

In the meantime, we could run this as its own workflow job (see below). I tried this in a boilerplate repo that I have but it comes with the issue that sometimes cruft needs to update the CI workflows themselves. This requires extra-special write permissions that can can only come from a personal access token. I'm not comfortable with setting up this level of write permissions for a CI action that would be deployed across all template-derived repos. So, for now, I think we wait to see if a bot comes about

jobs:
  cruftupdate:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - name: Checkout the repo
        uses: actions/checkout@v4
      - name: Set up dependencies
        uses: mamba-org/setup-micromamba@v1
        with:
          micromamba-version: latest
          environment-name: ${{ github.event.repository.name }}-cruft
          create-args: cruft python=3.11
          post-cleanup: all
          cache-environment: true

      - name: Add dummy GitHub credentials
        run: |
          git config --global user.name Cruft check
          git config --global user.email [email protected]

      - name: Check project against template
        id: check
        run: cruft check
        continue-on-error: true

      - name: Check on failures
        if: steps.check.outcome != 'success'
        run: cruft update -y

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v6
        with:
          commit-message: Cruft - update against template
          title: Cruft - update against template
          body: |
            # Cruft - update against template

            Before you merge this PR, ensure all merge conflicts (documented in `.rej` files have been resolved)
          base: main
          labels: automated-pr, template
          branch: cruft-update
          delete-branch: true

Version

v0.2.0

@brynpickering brynpickering added the enhancement New feature or request label Mar 28, 2024
@brynpickering brynpickering changed the title template updates as bot PRs Template updates as bot PRs Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant