Skip to content
Open
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
44 changes: 44 additions & 0 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Renovate
on:
schedule:
- cron: "0 8 * * 1-5" # Weekdays at 8am UTC
workflow_dispatch: # Allow manual trigger

jobs:
renovate:
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.ACTIONS_APP_ID }}
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}

- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ steps.app-token.outputs.token }}

- name: Run Renovate
uses: renovatebot/github-action@v46.1.9
with:
configurationFile: renovate.json
token: ${{ steps.app-token.outputs.token }}
env:
RENOVATE_REPOSITORIES: ${{ github.repository }}

- name: Auto-approve Renovate PRs
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh pr list --repo ${{ github.repository }} --state open --json number,headRefName --jq '.[] | select(.headRefName | startswith("improvement/renovate-")) | .number' | while read -r pr; do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto-approve step filters PRs only by branch name prefix (improvement/renovate-), not by PR author. Anyone with push access could create a branch matching this pattern and receive an automatic /approve. Add an author check to the jq filter — include author in the --json fields and filter on .author.login.

— Claude Code

if ! gh pr view "$pr" --repo ${{ github.repository }} --json comments --jq '.comments[].body' | grep -q '^/approve$'; then
gh pr comment "$pr" --repo ${{ github.repository }} --body '/approve'
echo "Approved PR #$pr"
else
echo "PR #$pr already approved, skipping"
fi
done
27 changes: 27 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["config:recommended"],
"enabledManagers": ["dockerfile"],
"branchPrefix": "improvement/renovate-",
"includePaths": [
"shell-ui/Dockerfile",
"ui/Dockerfile",
"images/metalk8s-ui/Dockerfile"
],
"packageRules": [
{
"matchManagers": ["dockerfile"],
"groupName": "ui-base-images"
},
{
"matchManagers": ["dockerfile"],
"matchUpdateTypes": ["minor", "patch"],
"addLabels": ["dependencies", "docker", "renovate"]
},
{
"matchManagers": ["dockerfile"],
"matchUpdateTypes": ["major"],
"addLabels": ["dependencies", "docker", "major", "renovate"]
}
]
}
Loading