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
16 changes: 7 additions & 9 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"gitAuthor": "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>",
"minimumReleaseAge": "14 days",
"customManagers": [
{
"customType": "regex",
"managerFilePatterns": ["/\\.github/workflows/.*\\.yaml$/"],
"matchStrings": ["uses:\\s+(?<depName>[\\w-]+/[\\w-]+)@(?<currentDigest>[a-f0-9]+)\\s+#\\s+(?<currentValue>v[\\S]+)"],
"datasourceTemplate": "github-releases"
},
{
"customType": "regex",
"description": "Update SHA-pinned actions in .jinja template files",
Expand All @@ -22,10 +16,9 @@
},
{
"customType": "regex",
"description": "Update copier-flake ref in Nix flake inputs",
"description": "Update SHA-pinned Nix flake inputs in template files",
"managerFilePatterns": ["/template/flake\\.nix\\.jinja$/", "/includes/flake-extra-inputs\\.jinja$/"],
"matchStrings": ["github:gordon-code/copier-flake/(?<currentDigest>[a-f0-9]+).*#\\s*(?<currentValue>v[\\S]+)"],
"depNameTemplate": "gordon-code/copier-flake",
"matchStrings": ["github:(?<depName>[\\w-]+/[\\w-]+)/(?<currentDigest>[a-f0-9]+).*#\\s*(?<currentValue>v[\\S]+)"],
"datasourceTemplate": "github-releases"
}
],
Expand All @@ -39,6 +32,11 @@
"matchUpdateTypes": ["major"],
"groupName": "major dependencies",
"groupSlug": "major"
},
{
"matchManagers": ["github-actions"],
"matchFileNames": ["template/**"],
"enabled": false
}
]
}
53 changes: 53 additions & 0 deletions .github/workflows/render-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Template-repo only: re-renders root files after Renovate updates includes/template
name: Render Template

on:
push:
branches: ['renovate/**']
paths: ['includes/**', 'template/**']

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
render:
runs-on: ubuntu-latest
permissions:
contents: write
timeout-minutes: 15
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.ref }}
token: ${{ secrets.RENOVATE_TOKEN }}

- uses: ./.github/actions/nix-setup

- name: Set up Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Re-render from template
run: nix develop -c just render

- name: Update flake lock if inputs changed
run: |
if ! git diff --quiet flake.nix; then
nix flake lock
fi

- name: Restore copier answers
run: git restore .copier-answers.yaml

- name: Commit and push if changed
run: |
if [ -n "$(git status --porcelain)" ]; then
git add -A
git commit -m "chore: re-render root files from updated template"
git push
fi
5 changes: 2 additions & 3 deletions includes/renovate-template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
},
{
"customType": "regex",
"description": "Update copier-flake ref in Nix flake inputs",
"description": "Update SHA-pinned Nix flake inputs in template files",
"managerFilePatterns": ["/template/flake\\.nix\\.jinja$/", "/includes/flake-extra-inputs\\.jinja$/"],
"matchStrings": ["github:gordon-code/copier-flake/(?<currentDigest>[a-f0-9]+).*#\\s*(?<currentValue>v[\\S]+)"],
"depNameTemplate": "gordon-code/copier-flake",
"matchStrings": ["github:(?<depName>[\\w-]+/[\\w-]+)/(?<currentDigest>[a-f0-9]+).*#\\s*(?<currentValue>v[\\S]+)"],
"datasourceTemplate": "github-releases"
}
{% endif %}
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ render:
git show HEAD:lib/nix/project.nix > lib/nix/project.nix 2>/dev/null || true
git show HEAD:justfile > justfile 2>/dev/null || true
git show HEAD:.gitignore > .gitignore 2>/dev/null || true
git show HEAD:.github/workflows/render-template.yaml > .github/workflows/render-template.yaml 2>/dev/null || true

# Run unit tests
test:
Expand Down
13 changes: 7 additions & 6 deletions template/.github/renovate.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
"gitAuthor": "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>",
"minimumReleaseAge": "14 days",
"customManagers": [
{
"customType": "regex",
"managerFilePatterns": ["/\\.github/workflows/.*\\.yaml$/"],
"matchStrings": ["uses:\\s+(?<depName>[\\w-]+/[\\w-]+)@(?<currentDigest>[a-f0-9]+)\\s+#\\s+(?<currentValue>v[\\S]+)"],
"datasourceTemplate": "github-releases"
}{{ ',' if _is_template else '' }}
{% include pathjoin("includes", "renovate-template.jinja") ignore missing %}
],
"packageRules": [
Expand All @@ -25,6 +19,13 @@
"matchUpdateTypes": ["major"],
"groupName": "major dependencies",
"groupSlug": "major"
}{{ ',' if _is_template else '' }}
{% if _is_template %}
{
"matchManagers": ["github-actions"],
"matchFileNames": ["template/**"],
"enabled": false
}
{% endif %}
]
}
10 changes: 10 additions & 0 deletions tests/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,16 @@ def test_renovate_has_template_config(generated_template_project):
assert template_managers, "No template-specific customManagers found"


def test_renovate_template_suppresses_builtin_gha(generated_template_project):
"""Template repo disables built-in github-actions manager for template paths."""
data = parse_json(generated_template_project / ".github" / "renovate.json")
rules = data.get("packageRules", [])
gha_rule = [r for r in rules if r.get("matchManagers") == ["github-actions"]]
assert gha_rule, "No packageRule suppressing github-actions for template paths"
assert gha_rule[0].get("matchFileNames") == ["template/**"]
assert gha_rule[0].get("enabled") is False


def test_no_consistency_job_default(generated_github_project):
"""Default projects have no consistency job in pr-checks."""
assert "consistency" not in (generated_github_project / ".github" / "workflows" / "pr-checks.yaml").read_text()
Expand Down
Loading