This repository was archived by the owner on Feb 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (48 loc) · 1.69 KB
/
pre-commit.yml
File metadata and controls
60 lines (48 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Copyright © 2024 Fabian H. Schneider
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/.
name: ☝️🧐 pre-commit
on:
push:
workflow_dispatch:
concurrency:
group: pre-commit-${{ github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
contents: write # needed for auto-commit
steps:
- name: Set up Python 3.14
uses: actions/setup-python@v5.1.1
with:
python-version: 3.14
- name: Install dependencies
run: |
pip3.14 install pre-commit
- uses: actions/checkout@v4.1.7
- name: Run pre-commit on all files
id: pre-commit
run: |
pre-commit run --all-files | tee msg.txt; echo "status=$?" >> $GITHUB_OUTPUT
- name: Set commit message
id: commit-message
run: |
sed -i '/^\[INFO\]/d' msg.txt
echo 'message<<EOF' >> $GITHUB_OUTPUT
echo 'Run pre-commit' >> $GITHUB_OUTPUT
echo '' >> $GITHUB_OUTPUT
cat msg.txt >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
rm -rf msg.txt
- uses: stefanzweifel/git-auto-commit-action@v5.0.1
with:
commit_message: ${{ steps.commit-message.outputs.message }}
branch: ${{ github.ref }}
# TODO: Sign commit: https://github.com/marketplace/actions/git-auto-commit#signing-commits
- name: pre-commit result
run: |
printf '%s\n' "${{ steps.commit-message.outputs.message }}"
exit ${{ steps.pre-commit.outputs.status }}