From 17ec77eeb3874f5f39addf8e820178882ec0f5bb Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Mon, 14 Apr 2025 12:06:37 +0200 Subject: [PATCH] ci: Replace the pre-commit.ci app with github workflows Since we're using the uv hook, pre-commit requires the internet to work properly which the pre-commit.ci app ran jobs don't have access to. These two workflows are meant to replace the app entirely by doing both checking on PRs/main and auto updates. It means that we do lose the autofix feature, but it's that or throwing away the uv-lock hook. Original work done in https://github.com/taskcluster/taskgraph/pull/677 and https://github.com/taskcluster/taskgraph/pull/678 Also ran uv sync to make pre-commit happy --- .github/workflows/pre-commit-autoupdate.yml | 15 +++++++++++++++ .github/workflows/pre-commit.yml | 12 ++++++++++++ .pre-commit-config.yaml | 2 -- uv.lock | 2 +- 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pre-commit-autoupdate.yml create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml new file mode 100644 index 0000000..cc2be89 --- /dev/null +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -0,0 +1,15 @@ +name: Autoupdate +on: + schedule: + - cron: '0 0 1 * *' +jobs: + pre-commit: + name: Pre-commit + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: mozilla-releng/actions/pre-commit-autoupdate@main + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..db22aa0 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,12 @@ +--- +name: "Pre-commit" +on: + pull_request: + push: + branches: [main] +jobs: + pre-commit: + name: Run pre-commit hooks + runs-on: ubuntu-latest + steps: + - uses: mozilla-releng/actions/pre-commit@main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e668f1..562bee6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,9 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks --- ci: - autofix_commit_msg: "style: pre-commit.ci auto fixes [...]" autoupdate_commit_msg: "chore: pre-commit autoupdate" - autoupdate_schedule: monthly repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 diff --git a/uv.lock b/uv.lock index e4b7306..f9ea92b 100644 --- a/uv.lock +++ b/uv.lock @@ -567,7 +567,7 @@ wheels = [ [[package]] name = "mozilla-taskgraph" -version = "3.0.3" +version = "3.0.4" source = { editable = "." } dependencies = [ { name = "taskcluster-taskgraph" },