Skip to content

Commit bcf540a

Browse files
committed
Upgrade workflow actions in template
1 parent d43f2da commit bcf540a

File tree

12 files changed

+98
-21
lines changed

12 files changed

+98
-21
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
mode: 'agent'
3+
description: 'Upgrade action versions in workflows of the template.'
4+
---
5+
6+
# GitHub Actions Version Upgrade Prompt
7+
8+
Please update all GitHub workflow files in the template directory (`{{cookiecutter.__package_slug}}/.github/workflows/`) to use the latest action versions while maintaining major version references and preserving all Jinja templating.
9+
10+
## Task Requirements:
11+
12+
### 1. File Location
13+
- Target directory: `{{cookiecutter.__package_slug}}/.github/workflows/`
14+
- Update ALL `.yaml` workflow files in this directory
15+
- These are Jinja template files, so YAML formatting may appear broken due to template syntax - this is expected and should be preserved
16+
17+
### 2. Actions to Update
18+
- **First, discover all GitHub Actions used** by reading through all workflow files in the target directory
19+
- **Research each action's latest version** by checking their respective GitHub releases pages
20+
- **Categorize actions appropriately**:
21+
- Core GitHub actions (actions/*)
22+
- Docker actions (docker/*)
23+
- PyPI/Python actions (pypa/*)
24+
- Third-party actions (other organizations)
25+
- **Apply appropriate update strategies** based on action type and current version patterns
26+
27+
### 3. Version Format Rules
28+
- **Use MAJOR versions only** (e.g., `v5`, `v6`, not `v5.2.1` or `v6.18.0`)
29+
- Major version tags automatically receive compatible updates
30+
- Exception: `pypa/gh-action-pypi-publish@release/v1` should stay as-is
31+
32+
### 4. Research Method
33+
- Look up latest versions by fetching GitHub releases pages
34+
- Infer GitHub URLs from action names (e.g., `actions/checkout``https://github.com/actions/checkout/releases`)
35+
- Use the web to find the most recent stable major version
36+
- Don't update to pre-release or beta versions
37+
38+
### 5. Template Preservation
39+
**CRITICAL:** Preserve ALL existing Jinja template syntax:
40+
- `{% raw %}${{ github.actor }}{% endraw %}`
41+
- `{% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}`
42+
- `{% raw %}${{ matrix.version }}{% endraw %}`
43+
- Cookiecutter variables like `cookiecutter.include_fastapi`
44+
- Conditional blocks: `{%- if cookiecutter.include_celery == "y" %}`
45+
- Template comments and whitespace
46+
47+
### 6. File Discovery
48+
- **Discover all workflow files** by listing all `.yaml` files in the target directory
49+
- **Don't assume file names** - read the directory contents to find all workflow files that need updating
50+
51+
### 7. Verification Steps
52+
After updating:
53+
1. Confirm all action versions are updated to latest major versions
54+
2. Verify Jinja templating is intact
55+
3. Check that YAML structure is preserved (even if it looks broken due to templates)
56+
57+
### 8. Example Updates
58+
```yaml
59+
# Before:
60+
- uses: actions/checkout@v4
61+
- uses: actions/setup-python@v5
62+
- uses: docker/[email protected]
63+
64+
# After:
65+
- uses: actions/checkout@v5
66+
- uses: actions/setup-python@v6
67+
- uses: docker/setup-qemu-action@v3
68+
```
69+
70+
## Implementation Approach:
71+
1. **Discover**: List all workflow files and identify all GitHub Actions used
72+
2. **Research**: Look up current latest versions for each discovered action
73+
3. **Plan**: Create a mapping of old version → new version
74+
4. **Update**: Use precise string replacement to update each action reference
75+
5. **Verify**: Check a few files to ensure changes are correct and templates preserved
76+
77+
Remember: This is a cookiecutter template, so the YAML may appear malformed due to Jinja syntax, but this is intentional and must be preserved.

{{cookiecutter.__package_slug}}/.github/workflows/alembic.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
alembic:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212

13-
- uses: actions/setup-python@v5
13+
- uses: actions/setup-python@v6
1414
with:
1515
python-version-file: .python-version
1616

{{cookiecutter.__package_slug}}/.github/workflows/black.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
black:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212

13-
- uses: actions/setup-python@v5
13+
- uses: actions/setup-python@v6
1414
with:
1515
python-version-file: .python-version
1616

{{cookiecutter.__package_slug}}/.github/workflows/dapperdata.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
dapperdata:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212

13-
- uses: actions/setup-python@v5
13+
- uses: actions/setup-python@v6
1414
with:
1515
python-version-file: .python-version
1616

{{cookiecutter.__package_slug}}/.github/workflows/docker.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
uses: docker/setup-buildx-action@v3
4141

4242
- name: Check out the repo
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@v5
4444

4545
- name: Log in to the Container registry
4646
uses: docker/login-action@v3

{{cookiecutter.__package_slug}}/.github/workflows/lockfiles.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414

1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v4
17+
uses: actions/checkout@v5
1818

19-
- uses: actions/setup-python@v5
19+
- uses: actions/setup-python@v6
2020
with:
2121
python-version-file: .python-version
2222

{{cookiecutter.__package_slug}}/.github/workflows/mypy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
mypy:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212

13-
- uses: actions/setup-python@v5
13+
- uses: actions/setup-python@v6
1414
with:
1515
python-version-file: .python-version
1616

{{cookiecutter.__package_slug}}/.github/workflows/paracelsus.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ jobs:
88
paracelsus:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v5
1212

13-
- uses: actions/setup-python@v5
13+
- uses: actions/setup-python@v6
1414
with:
1515
python-version-file: .python-version
1616

{{cookiecutter.__package_slug}}/.github/workflows/pypi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ jobs:
2121
permissions:
2222
id-token: write
2323
steps:
24-
- uses: actions/checkout@v4
24+
- uses: actions/checkout@v5
2525
with:
2626
fetch-depth: 0
2727
fetch-tags: true
2828

29-
- uses: actions/setup-python@v5
29+
- uses: actions/setup-python@v6
3030
with:
3131
python-version-file: .python-version
3232

{{cookiecutter.__package_slug}}/.github/workflows/pytest.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
matrix:
1616
version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v5
1919

20-
- uses: actions/setup-python@v5
20+
- uses: actions/setup-python@v6
2121
with:
2222
python-version: {% raw %}${{ matrix.version }}{% endraw %}
2323

0 commit comments

Comments
 (0)