-
Notifications
You must be signed in to change notification settings - Fork 1
140 lines (118 loc) · 5.8 KB
/
renovate-analysis.yml
File metadata and controls
140 lines (118 loc) · 5.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Renovate PR Analysis
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
inputs:
pr_number:
description: 'PR number to analyze (leave empty for all open Renovate PRs)'
required: false
type: string
env:
OWNER: lenaxia
REPO: talos-ops-prod
jobs:
analyze-prs:
# Only run for Renovate PRs or manual triggers
if: |
github.event_name != 'pull_request' ||
github.event.pull_request.user.login == 'renovate[bot]'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
# Skip analysis if the PR was already analyzed and hasn't been updated since
- name: Check if already analyzed
id: pre-check
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TRIGGERING_PR: ${{ github.event.pull_request.number || inputs.pr_number || '' }}
EVENT_NAME: ${{ github.event_name }}
run: |
# Only skip-check for single-PR pull_request events (not manual all-PR runs)
if [ "$EVENT_NAME" != "pull_request" ] || [ -z "$TRIGGERING_PR" ]; then
echo "skip=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Checking if PR #$TRIGGERING_PR was already analyzed..."
PR_DATA=$(gh pr view "$TRIGGERING_PR" --json updatedAt)
PR_UPDATED=$(echo "$PR_DATA" | jq -r '.updatedAt')
echo "PR last updated: $PR_UPDATED"
EXISTING_COMMENTS=$(gh pr view "$TRIGGERING_PR" --json comments \
--jq '.comments[] | select(.author.login == "github-actions" and (.body | startswith("## Renovate PR Analysis")))')
if [ -z "$EXISTING_COMMENTS" ]; then
echo "No existing analysis found. Proceeding."
echo "skip=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Found existing analysis comment(s)"
COMMENT_DATE=$(echo "$EXISTING_COMMENTS" | jq -r '.createdAt' | tail -1)
echo "Most recent analysis: $COMMENT_DATE"
PR_UPDATED_TS=$(date -d "$PR_UPDATED" +%s 2>/dev/null || echo "0")
COMMENT_DATE_TS=$(date -d "$COMMENT_DATE" +%s 2>/dev/null || echo "0")
COMMENT_BUFFER_TS=$((COMMENT_DATE_TS + 60))
if [ "$PR_UPDATED_TS" -le "$COMMENT_BUFFER_TS" ]; then
echo "PR #$TRIGGERING_PR already analyzed and not updated since. Skipping."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "PR #$TRIGGERING_PR updated after last analysis. Re-analyzing."
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Analyze with OpenCode
if: steps.pre-check.outputs.skip != 'true'
uses: anomalyco/opencode/github@v1.14.31
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_API_BASE: ${{ secrets.OPENAI_API_BASE }}
OPENAI_MODEL: ${{ vars.OPENAI_MODEL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
model: ${{ vars.OPENAI_PROVIDER || 'openai' }}/${{ vars.OPENAI_MODEL }}
use_github_token: "true"
share: "false"
prompt: |
You are an AI assistant that analyzes Renovatebot pull requests for talos-ops-prod, a Talos Linux Kubernetes cluster managed with Flux GitOps.
Target PR (empty = find and analyze all open Renovate PRs): ${{ inputs.pr_number }}
Task: Analyze Renovate PR(s) and post a detailed report as a PR comment. Do NOT merge any PRs.
For each PR to analyze:
1. Parse the PR title: identify the dependency, version range (old → new), update type (patch/minor/major/digest).
2. Identify the upstream repository:
- Helm charts: Chart.yaml repository URL or PR body links
- Docker images: image source repository
- GitHub Actions: the action's repository
- Check the PR body for links
3. Fetch release notes from upstream for the new version(s). For minor/major, fetch all versions between old and new.
4. Analyze impact on this codebase:
- Helm charts: check the helmrelease.yaml values we're currently using
- GitHub Actions: check .github/workflows/ usage
- Breaking changes? Deprecated options we use? New required parameters?
5. Post a comment on the PR using this exact structure:
## Renovate PR Analysis
### Update Summary
- Dependency: [name]
- Version: [old] → [new]
- Type: [patch/minor/major/digest]
### Release Changes
[new features, bug fixes, security fixes]
### Breaking Changes
[list, or "None affecting our usage"]
### Configuration Changes Required
[specific changes needed to our Helm values or config, or "None"]
### Migration Notes
[migration steps from upstream, or "None"]
### Recommendation
[Safe to merge / Needs manual review / Requires code changes] — [reason]
6. Act on the recommendation:
- Safe to merge: merge with squash method (github_merge_pull_request)
- Requires code changes: create branch config/renovate-pr-{number}-changes, make changes, open a PR, comment on the Renovate PR with the link
- Needs manual review: post comment only, do NOT merge
Special exclusions (always "Needs manual review", never auto-merge):
- MinIO — deprecated open source, became open source hostile
- Bitnami — revoked open-source license
Skip PRs with "abandoned" in the title.