Skip to content

Commit 865274f

Browse files
committed
feat: upgraded workflows
1 parent 72806cc commit 865274f

File tree

3 files changed

+72
-26
lines changed

3 files changed

+72
-26
lines changed

.github/workflows/pull-request-management.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,22 @@ jobs:
6565
const branch = pr.head.ref;
6666
const labelsToApply = [];
6767
const labelMap = [
68-
{ regex: /^feat\//i, label: 'feature' },
69-
{ regex: /^(bug)?fix\//i, label: 'bug-P3' },
70-
{ regex: /^docs\//i, label: 'documentation' },
71-
{ regex: /^chore\//i, label: 'update' },
72-
{ regex: /^test\//i, label: 'test' },
73-
{ regex: /^refactor\//i, label: 'refactor' },
74-
{ regex: /^hotfix\//i, label: 'hot-fix' },
75-
{ regex: /^proto(type)?\//i, label: 'prototype' },
76-
{ regex: /^idea\//i, label: 'idea' },
77-
{ regex: /^question\//i, label: 'question' },
68+
{ regex: /^(bug)?fix\//i, labels: ['bug-P3'] },
69+
{ regex: /^chore\//i, labels: ['chore','update'] },
70+
{ regex: /^deps\//i, labels: ['chore','dependencies'] },
71+
{ regex: /^docs\//i, labels: ['documentation','update'] },
72+
{ regex: /^feat\//i, labels: ['feature'] },
73+
{ regex: /^hotfix\//i, labels: ['hot-fix'] },
74+
{ regex: /^idea\//i, labels: ['idea'] },
75+
{ regex: /^proto(type)?\//i, labels: ['prototype','idea'] },
76+
{ regex: /^question\//i, labels: ['question'] },
77+
{ regex: /^refactor\//i, labels: ['refactor'] },
78+
{ regex: /^test\//i, labels: ['test'] },
7879
];
7980
80-
for (const { regex, label } of labelMap) {
81+
for (const { regex, labels } of labelMap) {
8182
if (regex.test(branch)) {
82-
labelsToApply.push(label);
83+
labelsToApply.push(...labels);
8384
}
8485
}
8586

.github/workflows/update-pip-requirements.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Triggers: Runs every Monday at 08:20 UTC and can be triggered manually.
88
#
9-
# Maintainer: @mrz1836
9+
# Maintainer: @icellan
1010
# ------------------------------------------------------------------------------
1111

1212
name: update-pip-requirements
@@ -51,10 +51,15 @@ jobs:
5151
- name: Update requirements file
5252
run: python .github/scripts/update_pip_requirements.py
5353

54+
- name: Configure git for PAT
55+
run: |
56+
git config --global url."https://x-access-token:${{ secrets.GH_PAT_TOKEN }}@github.com/".insteadOf "https://github.com/"
57+
5458
- name: Create pull request
5559
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
5660
with:
61+
token: ${{ secrets.GH_PAT_TOKEN }}
5762
commit-message: 'chore: update pip requirements'
58-
title: 'chore: update pip requirements'
63+
title: 'chore(deps): update pip requirements'
5964
body: 'This PR updates the Python dependencies in `.github/pip-requirements.txt`. '
6065
branch: 'chore/update-pip-requirements'

.github/workflows/update-pre-commit-hooks.yml

Lines changed: 52 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,32 @@ jobs:
3030
permissions:
3131
contents: write
3232
pull-requests: write
33+
3334
steps:
34-
# Checkout code
35+
# -- 1. Checkout full history so we can push a branch -------------------
3536
- name: Checkout code
36-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
37+
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
38+
with:
39+
fetch-depth: 0
40+
41+
# -- 2. Configure git for authenticated fetches ------------------------
42+
- name: Configure git for GitHub authentication
43+
run: |
44+
git config --global url."https://x-access-token:${{ secrets.GH_PAT_TOKEN }}@github.com/".insteadOf "https://github.com/"
45+
46+
# -- 3. Set commit author identity (fixes 'please tell me who you are')
47+
- name: Set git author
48+
run: |
49+
git config --global user.name "github-actions[bot]"
50+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
3751
38-
# Set up Python
52+
# -- 4. Set up Python ---------------------------------------------------
3953
- name: Set up Python
40-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
54+
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
4155
with:
4256
python-version: '3.x'
4357

44-
# Cache pip dependencies
58+
# -- 5. Cache pip dependencies -----------------------------------------
4559
- name: Cache pip dependencies
4660
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4761
with:
@@ -50,19 +64,45 @@ jobs:
5064
restore-keys: |
5165
${{ runner.os }}-pip-
5266
53-
# Install pre-commit
67+
# -- 6. Install pre-commit ---------------------------------------------
5468
- name: Install pre-commit
55-
run: pip install --require-hashes -r requirements.txt
69+
run: pip install --require-hashes -r .github/pip-requirements.txt
5670

57-
# Run pre-commit autoupdate
71+
# -- 7. Run autoupdate (with --freeze) and commit if something changed --
5872
- name: Run pre-commit autoupdate
59-
run: pre-commit autoupdate
73+
id: update
74+
run: |
75+
pre-commit autoupdate --freeze
76+
pre-commit migrate-config
77+
git add .pre-commit-config.yaml
78+
if ! git diff --cached --quiet; then
79+
git commit -m "chore: update pre-commit hooks"
80+
echo "changed=true" >> "$GITHUB_OUTPUT"
81+
fi
6082
61-
# Create pull request
83+
# -- 8. Check if there are changes to commit -----------------------------
84+
- name: Configure git for PAT
85+
run: |
86+
git config --global url."https://x-access-token:${{ secrets.GH_PAT_TOKEN }}@github.com/".insteadOf "https://github.com/"
87+
88+
# -- 9. Push changes if there are any --------------------------------------
6289
- name: Create pull request
90+
if: steps.update.outputs.changed == 'true'
6391
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
6492
with:
93+
token: ${{ secrets.GH_PAT_TOKEN }}
6594
commit-message: "chore: update pre-commit hooks"
66-
title: "chore: update pre-commit hooks"
67-
body: "This PR updates all pre-commit hooks to their latest versions."
95+
title: "chore(deps): update pre-commit hooks"
96+
body: |
97+
This automated pull request updates all pre-commit hooks to their latest versions as of this week.
98+
99+
**What's changed:**
100+
- All hooks in `.pre-commit-config.yaml` have been updated using `pre-commit autoupdate --freeze`.
101+
- The configuration has been migrated if needed.
102+
103+
**Why this matters:**
104+
- Keeps code quality tools up-to-date.
105+
- Ensures compatibility and security with the latest hook releases.
106+
107+
**No manual action is required** unless you notice issues with the updated hooks. Please review and merge if everything looks good.
68108
branch: "chore/update-pre-commit-hooks"

0 commit comments

Comments
 (0)