Skip to content

Commit 250a8c0

Browse files
authored
Build(deps-dev): Bump frequenz-repo-config from 0.13.8 to 0.17.0 in the repo-config group (#263)
Bumps the repo-config group with 1 update: [frequenz-repo-config](https://github.com/frequenz-floss/frequenz-repo-config-python). Updates `frequenz-repo-config` from 0.13.8 to 0.17.0 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/frequenz-floss/frequenz-repo-config-python/releases">frequenz-repo-config's releases</a>.</em></p> <blockquote> <h2>v0.17.0</h2> <h1>Frequenz Repository Configuration Release Notes</h1> <h2>Summary</h2> <p>This release improves workflows security, adds a black migration workflow, and fixes failed migrations from version v0.16.0.</p> <h2>Upgrading</h2> <h3>Cookiecutter template</h3> <p>All upgrading should be done via the migration script or regenerating the templates.</p> <pre lang="bash"><code>curl -sSLf https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/&lt;tag&gt;/cookiecutter/migrate.py | python3 -I </code></pre> <p>But you might still need to adapt your code:</p> <h2>New Features</h2> <h3>Cookiecutter template</h3> <ul> <li>Add a <code>black-migration.yaml</code> workflow that automatically reformats code when Dependabot upgrades <code>black</code>.</li> </ul> <h2>Bug Fixes</h2> <h3>Cookiecutter template</h3> <ul> <li>Fix migration of CI workflow matrices that used <code>arch</code>/<code>os</code> dimensions with values different from the default template. The v0.16.0 migration relied on exact string matching, so projects with customized matrix items (for example <code>arch: [amd64]</code>, <code>os: [ubuntu-24.04]</code>) could be left only partially migrated. The new migration step rebuilds the <code>platform</code> entries from the existing <code>arch</code>/<code>os</code> values and only rewrites <code>runs-on</code> when it still points to the old matrix keys.</li> <li>Improve workflows security: tighten permissions, avoid potential shell injection, run Python in isolated mode, pin all dependencies using the SHA hash.</li> </ul> <h2>What's Changed</h2> <ul> <li>Fix the cookiecutter migration script template by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/540">frequenz-floss/frequenz-repo-config-python#540</a></li> <li>build(deps): bump actions/create-github-app-token from 2.2.1 to 3.0.0 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/542">frequenz-floss/frequenz-repo-config-python#542</a></li> <li>build(deps): bump the patch group with 5 updates by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/543">frequenz-floss/frequenz-repo-config-python#543</a></li> <li>build(deps-dev): bump the minor group with 2 updates by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/544">frequenz-floss/frequenz-repo-config-python#544</a></li> <li>Reset release notes and migration script by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/539">frequenz-floss/frequenz-repo-config-python#539</a></li> <li>Improve workflows security by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/546">frequenz-floss/frequenz-repo-config-python#546</a></li> <li>build(deps-dev): bump mkdocs-material from 9.7.5 to 9.7.6 in the patch group by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/550">frequenz-floss/frequenz-repo-config-python#550</a></li> <li>build(deps-dev): bump setuptools-scm from 9.2.2 to 10.0.3 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/552">frequenz-floss/frequenz-repo-config-python#552</a></li> <li>build(deps-dev): update sybil requirement from &lt;10,&gt;=6.1.1 to &gt;=6.1.1,&lt;11 by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>[bot] in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/553">frequenz-floss/frequenz-repo-config-python#553</a></li> <li>Add black auto-migration workflow by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/556">frequenz-floss/frequenz-repo-config-python#556</a></li> <li>Handle private repos in workflow migration by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/548">frequenz-floss/frequenz-repo-config-python#548</a></li> <li>migrate: Fix missed CI platform matrix migrations by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/549">frequenz-floss/frequenz-repo-config-python#549</a></li> <li>Remove chardet pinning by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/554">frequenz-floss/frequenz-repo-config-python#554</a></li> <li>Prepare for v0.17.0 release by <a href="https://github.com/llucax"><code>@​llucax</code></a> in <a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/pull/557">frequenz-floss/frequenz-repo-config-python#557</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/5814b77ee5fad64a1125b0d638c673da807db606"><code>5814b77</code></a> Prepare for v0.17.0 release (<a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/issues/557">#557</a>)</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/3d3a0de5f782c2ef0ff9f03ac3487297911410fd"><code>3d3a0de</code></a> template: Bump version to the upcoming v0.17.0</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/b8165c523898e123d1fd6808f48b0e2ed73f21c1"><code>b8165c5</code></a> Prepare release notes for the v0.17.0 release</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/9bc1d611219bd9b9a530c5100dc98b8bdae129bd"><code>9bc1d61</code></a> Fix wrong trailing quote in migration script</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/f12570061d57858c026d1af23c4efdbedb1c11d3"><code>f125700</code></a> Normalize tag comment</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/488c80c4e821c341f6f2193ce53fc47057f4e22e"><code>488c80c</code></a> Remove chardet pinning (<a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/issues/554">#554</a>)</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/2ad88e7c5405645f1c92d52b04edbe8b11f3537b"><code>2ad88e7</code></a> migrate: Fix missed CI platform matrix migrations (<a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/issues/549">#549</a>)</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/eec17e37ac99db594454a6119540e362b7456164"><code>eec17e3</code></a> Handle private repos in workflow migration (<a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/issues/548">#548</a>)</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/ce994a3f765a0e9a58ab8aca6a0a5942c4067ce9"><code>ce994a3</code></a> Add black auto-migration workflow (<a href="https://redirect.github.com/frequenz-floss/frequenz-repo-config-python/issues/556">#556</a>)</li> <li><a href="https://github.com/frequenz-floss/frequenz-repo-config-python/commit/5800adfeff8f09ef92a41f02bc893211e5074506"><code>5800adf</code></a> Add release notes</li> <li>Additional commits viewable in <a href="https://github.com/frequenz-floss/frequenz-repo-config-python/compare/v0.13.8...v0.17.0">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=frequenz-repo-config&package-manager=pip&previous-version=0.13.8&new-version=0.17.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details>
2 parents fb30a52 + 45dfdd7 commit 250a8c0

10 files changed

Lines changed: 234 additions & 71 deletions
Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,49 @@
1-
name: Dependabot Auto Manage
2-
on: pull_request
1+
name: Auto-merge Dependabot PR
2+
3+
on:
4+
# XXX: !!! SECURITY WARNING !!!
5+
# pull_request_target has write access to the repo, and can read secrets. We
6+
# need to audit any external actions executed in this workflow and make sure no
7+
# checked out code is run (not even installing dependencies, as installing
8+
# dependencies usually can execute pre/post-install scripts). We should also
9+
# only use hashes to pick the action to execute (instead of tags or branches).
10+
# For more details read:
11+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
12+
pull_request_target:
313

414
permissions:
5-
contents: write
15+
# Read repository contents and Dependabot metadata used by the nested action.
16+
contents: read
17+
# The nested action also uses `github.token` internally for PR operations.
618
pull-requests: write
719

820
jobs:
9-
dependabot:
10-
runs-on: ubuntu-latest
11-
if: github.actor == 'dependabot[bot]'
21+
auto-merge:
22+
name: Auto-merge Dependabot PR
23+
if: >
24+
github.actor == 'dependabot[bot]' &&
25+
!contains(github.event.pull_request.title, 'the repo-config group') &&
26+
!contains(github.event.pull_request.title, 'Bump black from ')
27+
runs-on: ubuntu-slim
1228
steps:
13-
- uses: frequenz-floss/dependabot-auto-approve@e943399cc9d76fbb6d7faae446cd57301d110165 # v1.5.0
29+
- name: Generate GitHub App token
30+
id: app-token
31+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
32+
with:
33+
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
34+
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
35+
# Merge Dependabot PRs.
36+
permission-contents: write
37+
# Create the auto-merged label if it does not exist.
38+
permission-issues: write
39+
# Approve PRs, add labels, and enable auto-merge.
40+
permission-pull-requests: write
41+
42+
- name: Auto-merge Dependabot PR
43+
uses: frequenz-floss/dependabot-auto-approve@e943399cc9d76fbb6d7faae446cd57301d110165 # v1.5.0
1444
with:
45+
github-token: ${{ steps.app-token.outputs.token }}
1546
dependency-type: 'all'
1647
auto-merge: 'true'
17-
add-label: 'auto-merged'
48+
merge-method: 'merge'
49+
add-label: 'tool:auto-merged'
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Automatic black formatting migration for Dependabot PRs
2+
#
3+
# When Dependabot upgrades black, this workflow installs the new version
4+
# and runs `black .` so the PR already contains any formatting changes
5+
# introduced by the upgrade, while leaving the PR open for review.
6+
#
7+
# Black uses calendar versioning. Only the first release of a new calendar
8+
# year may introduce formatting changes (major bump in Dependabot's terms).
9+
# Minor and patch updates within a year keep formatting stable, so they stay
10+
# in the regular Dependabot groups and are auto-merged normally.
11+
#
12+
# The companion auto-dependabot workflow skips major black PRs so they're
13+
# handled exclusively by this migration workflow.
14+
#
15+
# XXX: !!! SECURITY WARNING !!!
16+
# pull_request_target has write access to the repo, and can read secrets.
17+
# This is required because Dependabot PRs are treated as fork PRs: the
18+
# GITHUB_TOKEN is read-only and secrets are unavailable with a plain
19+
# pull_request trigger. The action mitigates the risk by:
20+
# - Never executing code from the PR (the migration script is embedded
21+
# in this workflow file on the base branch, not taken from the PR).
22+
# - Gating migration steps on github.actor == 'dependabot[bot]'.
23+
# - Running checkout with persist-credentials: false and isolating
24+
# push credentials from the migration script environment.
25+
# For more details read:
26+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
27+
28+
name: Black Migration
29+
30+
on:
31+
merge_group: # To allow using this as a required check for merging
32+
pull_request_target:
33+
types: [opened, synchronize, reopened, labeled, unlabeled]
34+
35+
permissions:
36+
# Commit reformatted files back to the PR branch.
37+
contents: write
38+
# Create and normalize migration state labels.
39+
issues: write
40+
# Read/update pull request metadata and comments.
41+
pull-requests: write
42+
43+
jobs:
44+
black-migration:
45+
name: Migrate Black
46+
# Skip if it was triggered by the merge queue. We only need the workflow to
47+
# be executed to meet the "Required check" condition for merging, but we
48+
# don't need to actually run the job, having the job present as Skipped is
49+
# enough.
50+
if: |
51+
github.event_name == 'pull_request_target' &&
52+
github.actor == 'dependabot[bot]' &&
53+
contains(github.event.pull_request.title, 'Bump black from ')
54+
runs-on: ubuntu-24.04
55+
steps:
56+
- name: Generate token
57+
id: create-app-token
58+
uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0
59+
with:
60+
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
61+
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
62+
# Push reformatted files to the PR branch.
63+
permission-contents: write
64+
# Create and normalize migration state labels.
65+
permission-issues: write
66+
# Read/update pull request metadata and labels.
67+
permission-pull-requests: write
68+
- name: Migrate
69+
uses: frequenz-floss/gh-action-dependabot-migrate@b389f72f9282346920150a67495efbae450ac07b # v1.1.0
70+
with:
71+
migration-script: |
72+
import os
73+
import subprocess
74+
import sys
75+
76+
version = os.environ["MIGRATION_VERSION"].lstrip("v")
77+
subprocess.run(
78+
[sys.executable, "-Im", "pip", "install", f"black=={version}"],
79+
check=True,
80+
)
81+
subprocess.run([sys.executable, "-Im", "black", "."], check=True)
82+
token: ${{ steps.create-app-token.outputs.token }}
83+
auto-merge-on-changes: "false"
84+
sign-commits: "true"
85+
auto-merged-label: "tool:auto-merged"
86+
migrated-label: "tool:black:migration:executed"
87+
intervention-pending-label: "tool:black:migration:intervention-pending"
88+
intervention-done-label: "tool:black:migration:intervention-done"

.github/workflows/ci-pr.yaml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Test PR
33
on:
44
pull_request:
55

6+
permissions:
7+
# Read repository contents for checkout and dependency resolution only.
8+
contents: read
9+
610
env:
711
# Please make sure this version is included in the `matrix`, as the
812
# `matrix` section can't use `env`, so it must be entered manually
@@ -17,7 +21,7 @@ jobs:
1721

1822
steps:
1923
- name: Run nox
20-
uses: frequenz-floss/gh-action-nox@v1.1.0
24+
uses: frequenz-floss/gh-action-nox@e1351cf45e05e85afc1c79ab883e06322892d34c # v1.1.0
2125
with:
2226
python-version: "3.11"
2327
nox-session: ci_checks_max
@@ -27,15 +31,15 @@ jobs:
2731
runs-on: ubuntu-24.04
2832
steps:
2933
- name: Setup Git
30-
uses: frequenz-floss/gh-action-setup-git@v1.0.0
34+
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
3135

3236
- name: Fetch sources
33-
uses: actions/checkout@v6
37+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3438
with:
3539
submodules: true
3640

3741
- name: Setup Python
38-
uses: frequenz-floss/gh-action-setup-python-with-deps@v1.0.2
42+
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
3943
with:
4044
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
4145
dependencies: .[dev-mkdocs]
@@ -44,11 +48,14 @@ jobs:
4448
env:
4549
MIKE_VERSION: gh-${{ github.job }}
4650
run: |
47-
mike deploy $MIKE_VERSION
48-
mike set-default $MIKE_VERSION
51+
# mike is installed as a console script, not a runnable module.
52+
# Run the installed script under isolated mode to avoid importing from
53+
# the workspace when building docs from checked-out code.
54+
python -I "$(command -v mike)" deploy "$MIKE_VERSION"
55+
python -I "$(command -v mike)" set-default "$MIKE_VERSION"
4956
5057
- name: Upload site
51-
uses: actions/upload-artifact@v7
58+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
5259
with:
5360
name: docs-site
5461
path: site/

0 commit comments

Comments
 (0)