Skip to content

Commit 4ecdbca

Browse files
Apply migration from 0.17.0 to 0.18.0
=== v0.18.0 ========================================================= Script URL: https://raw.githubusercontent.com/frequenz-floss/frequenz-repo-config-python/v0.18.0/cookiecutter/migrate.py ======================================================================== Removing unused cross-arch testing files... Removed .github/containers/nox-cross-arch Removed .github/containers/test-installation Removed empty .github/containers Updated CONTRIBUTING.md: removed 'Cross-Arch Testing' section ======================================================================== Updating cookiecutter replay file... Updated .cookiecutter-replay.json: added `private_repo=no` replay data ======================================================================== Updating generated CI workflows... ======================================================================== Updating auxiliary GitHub workflows... Updated .github/workflows/black-migration.yaml: use explicit Dependabot migration iteration Updated .github/workflows/repo-config-migration.yaml: use explicit Dependabot migration iteration ======================================================================== Normalizing GitHub Action hashes... Updated .github/workflows/ci-pr.yaml: normalized GitHub Action hashes Updated .github/workflows/ci.yaml: normalized GitHub Action hashes ======================================================================== Updating issue template configuration... Skipped .github/ISSUE_TEMPLATE/config.yml: already up to date ======================================================================== Setting up the gRPC migration workflow... Skipped: not an API project (type='lib'); the gRPC migration workflow is only needed for API repositories. ======================================================================== Fixing nox test path typo in CONTRIBUTING.md... Updated CONTRIBUTING.md: fixed nox 'test/' -> 'tests/' typo ======================================================================== Adjusting CONTRIBUTING.md release section for repo privacy... Skipped CONTRIBUTING.md: public repository, no change needed ======================================================================== Excluding submodules from black for API projects... Skipped: not an API project (type='lib'); only API repositories ship a submodules/ directory. ======================================================================== Setting up the isort migration workflow... Created .github/workflows/isort-migration.yaml Updated .github/workflows/auto-dependabot.yaml: skip individual isort bump PRs Updated .github/dependabot.yml: added 'isort' to exclude-patterns of patch and minor ======================================================================== Excluding submodules from isort for API projects... Skipped: not an API project (type='lib'); only API repositories ship a submodules/ directory. ======================================================================== ✅ Migration script finished successfully ✅ The migration completed successfully.
1 parent fdd292e commit 4ecdbca

12 files changed

Lines changed: 119 additions & 106 deletions

.cookiecutter-replay.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"keywords": "client, api, python, trading, electricity-trading",
99
"github_org": "frequenz-floss",
1010
"license": "MIT",
11+
"private_repo": "no",
1112
"author_name": "Frequenz Energy-as-a-Service GmbH",
1213
"author_email": "floss@frequenz.com",
1314
"python_package": "frequenz.client.electricity_trading",
@@ -36,6 +37,10 @@
3637
"MIT",
3738
"Proprietary"
3839
],
40+
"private_repo": [
41+
"{{ 'yes' if cookiecutter.license == 'Proprietary' else 'no' }}",
42+
"{{ 'no' if cookiecutter.license == 'Proprietary' else 'yes' }}"
43+
],
3944
"author_name": "Frequenz Energy-as-a-Service GmbH",
4045
"author_email": "floss@frequenz.com",
4146
"python_package": "{{cookiecutter | python_package}}",

.github/containers/nox-cross-arch/arm64-ubuntu-20.04-python-3.11.Dockerfile

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/containers/nox-cross-arch/entrypoint.bash

Lines changed: 0 additions & 9 deletions
This file was deleted.

.github/containers/test-installation/Dockerfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ updates:
2929
exclude-patterns:
3030
# pydoclint has shipped breaking changes in patch updates often
3131
- "pydoclint"
32+
- "isort"
3233
minor:
3334
update-types:
3435
- "minor"
@@ -49,6 +50,7 @@ updates:
4950
- "mkdocstrings[python]"
5051
- "pydoclint"
5152
- "pytest-asyncio"
53+
- "isort"
5254
# We group repo-config updates as it uses optional dependencies that are
5355
# considered different dependencies otherwise, and will create one PR for
5456
# each if we don't group them.

.github/workflows/auto-dependabot.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ jobs:
2323
if: >
2424
github.actor == 'dependabot[bot]' &&
2525
!contains(github.event.pull_request.title, 'the repo-config group') &&
26-
!contains(github.event.pull_request.title, 'Bump black from ')
26+
!contains(github.event.pull_request.title, 'Bump black from ') &&
27+
!contains(github.event.pull_request.title, 'Bump isort from ')
2728
runs-on: ubuntu-slim
2829
steps:
2930
- name: Generate GitHub App token

.github/workflows/black-migration.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
# Read/update pull request metadata and labels.
6767
permission-pull-requests: write
6868
- name: Migrate
69-
uses: frequenz-floss/gh-action-dependabot-migrate@45994e185a9040449304a470e8f02d0e197873b4 # v1.1.1
69+
uses: frequenz-floss/gh-action-dependabot-migrate@27763fb5eb56476d91abe00132e8a0614171f92f # v1.2.0
7070
with:
7171
migration-script: |
7272
import os
@@ -81,6 +81,7 @@ jobs:
8181
subprocess.run([sys.executable, "-Im", "black", "."], check=True)
8282
token: ${{ steps.create-app-token.outputs.token }}
8383
auto-merge-on-changes: "false"
84+
version-iteration: "false"
8485
sign-commits: "true"
8586
auto-merged-label: "tool:auto-merged"
8687
migrated-label: "tool:black:migration:executed"

.github/workflows/ci-pr.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
runs-on: ubuntu-24.04
3232
steps:
3333
- name: Setup Git
34-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
34+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
3535

3636
- name: Fetch sources
3737
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3838
with:
3939
submodules: true
4040

4141
- name: Setup Python
42-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
42+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
4343
with:
4444
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
4545
dependencies: .[dev-mkdocs]

.github/workflows/ci.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,15 @@ jobs:
8080

8181
steps:
8282
- name: Setup Git
83-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
83+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
8484

8585
- name: Fetch sources
8686
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8787
with:
8888
submodules: true
8989

9090
- name: Setup Python
91-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
91+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
9292
with:
9393
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
9494
dependencies: build
@@ -119,7 +119,7 @@ jobs:
119119

120120
steps:
121121
- name: Setup Git
122-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
122+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
123123

124124
- name: Print environment (debug)
125125
run: env
@@ -145,7 +145,7 @@ jobs:
145145
> pyproject.toml
146146
147147
- name: Setup Python
148-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
148+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
149149
with:
150150
python-version: ${{ matrix.python }}
151151
dependencies: dist/*.whl
@@ -178,15 +178,15 @@ jobs:
178178
runs-on: ubuntu-24.04
179179
steps:
180180
- name: Setup Git
181-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
181+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
182182

183183
- name: Fetch sources
184184
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
185185
with:
186186
submodules: true
187187

188188
- name: Setup Python
189-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
189+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
190190
with:
191191
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
192192
dependencies: .[dev-mkdocs]
@@ -218,15 +218,15 @@ jobs:
218218
contents: write
219219
steps:
220220
- name: Setup Git
221-
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
221+
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
222222

223223
- name: Fetch sources
224224
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
225225
with:
226226
submodules: true
227227

228228
- name: Setup Python
229-
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
229+
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
230230
with:
231231
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
232232
dependencies: .[dev-mkdocs]
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Automatic isort migration for Dependabot PRs
2+
#
3+
# When Dependabot upgrades isort, this workflow installs the new version and
4+
# runs `isort .` so the PR already contains any import-ordering changes
5+
# introduced by the upgrade, while leaving the PR open for review.
6+
#
7+
# isort follows SemVer but its release policy
8+
# (https://github.com/PyCQA/isort/blob/main/docs/major_releases/release_policy.md)
9+
# explicitly allows intentional formatting changes in minor releases, and
10+
# patch releases may also adjust output in smaller bug-fix ways. Because of
11+
# that, isort is excluded from the regular `patch` and `minor` Dependabot
12+
# groups: every isort bump produces an individual `Bump isort from …` PR and
13+
# is routed through this migration workflow.
14+
#
15+
# The companion auto-dependabot workflow skips those PRs so they're handled
16+
# exclusively by this migration workflow.
17+
#
18+
# XXX: !!! SECURITY WARNING !!!
19+
# pull_request_target has write access to the repo, and can read secrets.
20+
# This is required because Dependabot PRs are treated as fork PRs: the
21+
# GITHUB_TOKEN is read-only and secrets are unavailable with a plain
22+
# pull_request trigger. The action mitigates the risk by:
23+
# - Never executing code from the PR (the migration script is embedded
24+
# in this workflow file on the base branch, not taken from the PR).
25+
# - Gating migration steps on github.actor == 'dependabot[bot]'.
26+
# - Running checkout with persist-credentials: false and isolating
27+
# push credentials from the migration script environment.
28+
# For more details read:
29+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
30+
31+
name: isort Migration
32+
33+
on:
34+
merge_group: # To allow using this as a required check for merging
35+
pull_request_target:
36+
types: [opened, synchronize, reopened, labeled, unlabeled]
37+
38+
permissions:
39+
# Commit reformatted files back to the PR branch.
40+
contents: write
41+
# Create and normalize migration state labels.
42+
issues: write
43+
# Read/update pull request metadata and comments.
44+
pull-requests: write
45+
46+
jobs:
47+
isort-migration:
48+
name: Migrate isort
49+
# Skip if it was triggered by the merge queue. We only need the workflow to
50+
# be executed to meet the "Required check" condition for merging, but we
51+
# don't need to actually run the job, having the job present as Skipped is
52+
# enough.
53+
if: |
54+
github.event_name == 'pull_request_target' &&
55+
github.actor == 'dependabot[bot]' &&
56+
contains(github.event.pull_request.title, 'Bump isort from ')
57+
runs-on: ubuntu-24.04
58+
steps:
59+
- name: Generate token
60+
id: create-app-token
61+
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
62+
with:
63+
app-id: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_ID }}
64+
private-key: ${{ secrets.FREQUENZ_AUTO_DEPENDABOT_APP_PRIVATE_KEY }}
65+
# Push reformatted files to the PR branch.
66+
permission-contents: write
67+
# Create and normalize migration state labels.
68+
permission-issues: write
69+
# Read/update pull request metadata and labels.
70+
permission-pull-requests: write
71+
- name: Migrate
72+
uses: frequenz-floss/gh-action-dependabot-migrate@27763fb5eb56476d91abe00132e8a0614171f92f # v1.2.0
73+
with:
74+
migration-script: |
75+
import os
76+
import subprocess
77+
import sys
78+
79+
version = os.environ["MIGRATION_VERSION"].lstrip("v")
80+
subprocess.run(
81+
[sys.executable, "-Im", "pip", "install", f"isort=={version}"],
82+
check=True,
83+
)
84+
subprocess.run([sys.executable, "-Im", "isort", "."], check=True)
85+
token: ${{ steps.create-app-token.outputs.token }}
86+
auto-merge-on-changes: "false"
87+
version-iteration: "false"
88+
sign-commits: "true"
89+
auto-merged-label: "tool:auto-merged"
90+
migrated-label: "tool:isort:migration:executed"
91+
intervention-pending-label: "tool:isort:migration:intervention-pending"
92+
intervention-done-label: "tool:isort:migration:intervention-done"

0 commit comments

Comments
 (0)