Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ But you might still need to adapt your code:
- The unused cross-arch QEMU-based testing infrastructure has been removed. The `.github/containers/nox-cross-arch/` and `.github/containers/test-installation/` directories, as well as the "Cross-Arch Testing" section in `CONTRIBUTING.md`.
- Private repositories now are generated with credentials uncommented and the publishing workflows disabled.
- The issue template chooser (`config.yml`) no longer includes the `contact_links` section for private repositories, since GitHub Discussions are typically disabled for them.
- Normalized the GitHub Action hashes for `gh-action-setup-git` and `gh-action-setup-python-with-deps` to point to the actual commit object, which is what Dependabot expects.
44 changes: 44 additions & 0 deletions cookiecutter/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def main() -> None:
print("Updating auxiliary GitHub workflows...")
migrate_auxiliary_workflows()
print("=" * 72)
print("Normalizing GitHub Action hashes...")
migrate_gh_actions_hashes()
print("=" * 72)
print("Updating issue template configuration...")
migrate_issue_templates()
print("=" * 72)
Expand Down Expand Up @@ -282,6 +285,47 @@ def migrate_auxiliary_workflows() -> None:
)


def migrate_gh_actions_hashes() -> None:
"""Update GitHub Action hashes to point to the actual commit object.

The hashes we were using are the annotated git tag object, but
Dependabot likes to have the pins to the actual commit object the
tag points to, not the tag itself.
"""
replacements = [
(
"frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace",
"frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90",
),
(
"frequenz-floss/gh-action-setup-python-with-deps@"
"0d0d77eac3b54799f31f25a1060ef2c6ebdf9299", # noqa: E501
"frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946", # noqa: E501
),
]

workflows_dir = Path(".github/workflows")
if not workflows_dir.is_dir():
print(f" Skipped {workflows_dir}: directory not found")
return

for wf in sorted(workflows_dir.iterdir()):
if wf.suffix not in (".yml", ".yaml"):
continue
try:
content = wf.read_text(encoding="utf-8")
except OSError:
continue

new_content = content
for old, new in replacements:
new_content = new_content.replace(old, new)

if new_content != content:
replace_file_atomically(wf, new_content)
print(f" Updated {wf}: normalized GitHub Action hashes")


def migrate_issue_templates() -> None:
"""Update issue template configuration for repository privacy.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
{%- endraw %}{% if cookiecutter.private_repo == "yes" %}{% raw %}
with:
username: ${{ secrets.GIT_USER }}
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
{%- endraw %}{% if cookiecutter.private_repo == "yes" %}{% raw %}
with:
username: ${{ secrets.GIT_USER }}
Expand All @@ -82,7 +82,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
{%- endraw %}{% if cookiecutter.private_repo == "yes" %}{% raw %}
with:
username: ${{ secrets.GIT_USER }}
Expand Down Expand Up @@ -118,7 +118,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
{%- endraw %}{% if cookiecutter.private_repo == "yes" %}{% raw %}
with:
username: ${{ secrets.GIT_USER }}
Expand All @@ -131,7 +131,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: build
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
{%- endraw %}{% if cookiecutter.private_repo == "yes" %}{% raw %}
with:
username: ${{ secrets.GIT_USER }}
Expand Down Expand Up @@ -193,7 +193,7 @@ jobs:
> pyproject.toml

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ matrix.python }}
dependencies: dist/*.whl
Expand Down Expand Up @@ -226,7 +226,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
{%- endraw %}{% if cookiecutter.private_repo == "yes" %}{% raw %}
with:
username: ${{ secrets.GIT_USER }}
Expand All @@ -239,7 +239,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down Expand Up @@ -272,15 +272,15 @@ jobs:
contents: write
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0

- name: Fetch sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
with:
username: ${{ secrets.GIT_USER }}
password: ${{ secrets.GIT_PASS }}
Expand All @@ -44,7 +44,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
with:
username: ${{ secrets.GIT_USER }}
password: ${{ secrets.GIT_PASS }}
Expand All @@ -93,7 +93,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: build
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
with:
username: ${{ secrets.GIT_USER }}
password: ${{ secrets.GIT_PASS }}
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
> pyproject.toml

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ matrix.python }}
dependencies: dist/*.whl
Expand Down Expand Up @@ -186,7 +186,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
with:
username: ${{ secrets.GIT_USER }}
password: ${{ secrets.GIT_PASS }}
Expand All @@ -197,7 +197,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0

- name: Fetch sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ jobs:

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

- name: Fetch sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

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

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

- name: Print environment (debug)
run: env
Expand All @@ -145,7 +145,7 @@ jobs:
> pyproject.toml

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ matrix.python }}
dependencies: dist/*.whl
Expand Down Expand Up @@ -178,15 +178,15 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0

- name: Fetch sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down Expand Up @@ -218,15 +218,15 @@ jobs:
contents: write
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0

- name: Fetch sources
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
with:
username: ${{ secrets.GIT_USER }}
password: ${{ secrets.GIT_PASS }}
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Setup Git
uses: frequenz-floss/gh-action-setup-git@16952aac3ccc01d27412fe0dea3ea946530dcace # v1.0.0
uses: frequenz-floss/gh-action-setup-git@f9d86a01228ee1cadaac5224d4d7626f1eb23f90 # v1.0.0
with:
username: ${{ secrets.GIT_USER }}
password: ${{ secrets.GIT_PASS }}
Expand All @@ -73,7 +73,7 @@ jobs:
submodules: true

- name: Setup Python
uses: frequenz-floss/gh-action-setup-python-with-deps@0d0d77eac3b54799f31f25a1060ef2c6ebdf9299 # v1.0.2
uses: frequenz-floss/gh-action-setup-python-with-deps@e4d0b2ef8f5a1612d7827f3abaef17c931d2b946 # v1.0.2
with:
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
dependencies: .[dev-mkdocs]
Expand Down
Loading
Loading