Skip to content

Commit c0a7f2c

Browse files
committed
Switch actions to use the mozilla-releng/actions ones
1 parent 6d455e8 commit c0a7f2c

File tree

2 files changed

+5
-38
lines changed

2 files changed

+5
-38
lines changed

.github/workflows/pre-commit-autoupdate.yml

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,6 @@ jobs:
1010
contents: write
1111
pull-requests: write
1212
steps:
13-
- uses: actions/checkout@v4
14-
- name: Setup git
15-
run: |
16-
git config --global user.name "Pre-commit automation"
17-
git config --global user.email "[email protected]"
18-
- uses: actions/setup-python@v5
19-
- run: python -m pip install pre-commit
20-
shell: bash
21-
- name: Get commit message
22-
run: |
23-
echo "COMMIT_MSG=$(cat .pre-commit-config.yaml | yq -r '.ci.autoupdate_commit_msg // "Update pre-commit config"')" >> $GITHUB_ENV
24-
- name: Update files
25-
run: |
26-
git checkout -B pre-commit-update
27-
pre-commit autoupdate -j4
28-
git add .pre-commit-config.yaml
29-
git commit -m "${COMMIT_MSG}"
30-
git push -f origin pre-commit-update
31-
- name: Create PR if necessary
32-
run: |
33-
curl -sL \
34-
-X POST \
35-
-H "Accept: application/vnd.github+json" \
36-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
37-
-H "X-GitHub-Api-Version: 2022-11-28" \
38-
https://api.github.com/repos${{ github.reository_owner }}/${{ github.repository }}/pulls \
39-
-d "{\"title\":\"${COMMIT_MSG}\",\"body\":\"\",\"head\":\"pre-commit-update\",\"base\":\"${{ github.event.repository.default_branch }}\"}"
13+
- uses: mozilla-releng/actions/pre-commit-autoupdate@main
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,7 @@ on:
66
branches: [main]
77
jobs:
88
pre-commit:
9-
name: Run pre-commit
9+
name: Run pre-commit hooks
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v5
14-
- run: python -m pip install pre-commit
15-
shell: bash
16-
- uses: actions/cache@v4
17-
with:
18-
path: ~/.cache/pre-commit
19-
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
20-
- run: pre-commit run --show-diff-on-failure --color=always -a
21-
shell: bash
12+
- uses: mozilla-releng/actions/pre-commit@main

0 commit comments

Comments
 (0)