Skip to content

Commit fe1e23f

Browse files
authored
ci: unify auto-merge across bots (#322)
* ci: unify auto-merge across bots Rename dependabot-auto-merge.yml to auto-merge.yml and add a job that merges the weekly pre-commit hook bump. The bump reaches every repository at once and carries nothing but `rev:` changes, yet each one had to be merged by hand. Add lf-pre-commit.yml so the updated hooks run over the whole tree before such a pull request is merged. * ci: run the pre-commit job on 3.13 The pinned pre-commit stack requires Python 3.10 or newer, so the py39 floor the controller plugins support cannot run it.
1 parent 064f7af commit fe1e23f

2 files changed

Lines changed: 64 additions & 2 deletions

File tree

.github/workflows/dependabot-auto-merge.yml renamed to .github/workflows/auto-merge.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Linuxfabrik: Dependabot auto-merge'
1+
name: 'Linuxfabrik: Auto-merge'
22

33
on:
44
pull_request: {}
@@ -17,7 +17,7 @@ env:
1717
FROZEN_LOCKFILES: '[]'
1818

1919
jobs:
20-
auto-merge:
20+
dependabot:
2121
runs-on: 'ubuntu-latest'
2222
if: 'github.actor == ''dependabot[bot]'''
2323
permissions:
@@ -63,3 +63,24 @@ jobs:
6363
env:
6464
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
6565
PR_URL: '${{ github.event.pull_request.html_url }}'
66+
67+
# The weekly hook bump carries nothing but `rev:` changes in
68+
# .pre-commit-config.yaml, and it arrives in every repository at once.
69+
# Merging that by hand is pure overhead, so it goes in as soon as the
70+
# required checks pass. The same fallback as above applies, and it is only
71+
# safe because the ruleset keeps enforcing those checks server-side.
72+
pre-commit-autoupdate:
73+
runs-on: 'ubuntu-latest'
74+
if: >-
75+
github.actor == 'linuxfabrik-automation[bot]'
76+
&& github.head_ref == 'chore/pre-commit-autoupdate'
77+
permissions:
78+
contents: 'write'
79+
pull-requests: 'write'
80+
steps:
81+
82+
- run: |
83+
gh pr merge --auto --squash "$PR_URL" || gh pr merge --squash "$PR_URL"
84+
env:
85+
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
86+
PR_URL: '${{ github.event.pull_request.html_url }}'
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 'Linuxfabrik: Pre-commit'
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request: {}
8+
9+
permissions:
10+
contents: 'read'
11+
12+
jobs:
13+
pre-commit:
14+
name: 'Pre-commit'
15+
runs-on: 'ubuntu-latest'
16+
steps:
17+
- name: 'Harden the runner (Audit all outbound calls)'
18+
uses: 'step-security/harden-runner@b09bb98e06d4d774595224525879c09bc6e98c40' # v2.20.1
19+
with:
20+
egress-policy: 'audit'
21+
22+
- name: 'Checkout repository'
23+
uses: 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1' # v7.0.1
24+
25+
# This runs pre-commit itself, not the collection. The pinned stack in
26+
# .github/pre-commit/requirements.txt needs 3.10 or newer, so it cannot
27+
# be the py39 floor the controller plugins support. That floor is
28+
# covered by the matrix in lf-unit-tests.yml instead.
29+
- name: 'Set up Python'
30+
uses: 'actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97' # v7.0.0
31+
with:
32+
python-version: '3.13'
33+
34+
- name: 'Install pre-commit'
35+
run: 'pip install --require-hashes --requirement .github/pre-commit/requirements.txt'
36+
37+
# --all-files, because the hooks otherwise only see what a commit
38+
# happens to touch, and nothing guarantees a contributor ran
39+
# `pre-commit install` at all.
40+
- name: 'Run the hooks over the whole tree'
41+
run: 'pre-commit run --all-files --show-diff-on-failure'

0 commit comments

Comments
 (0)