Skip to content

Commit 877f7b0

Browse files
committed
feat(ci): Auto-create Stale Component Removal PRs
- Add functionality to the stalness check ci script to create component removal PRs if flagged as fully stale Signed-off-by: Giulio Frasca <gfrasca@redhat.com>
1 parent 1eb1a2d commit 877f7b0

File tree

7 files changed

+405
-192
lines changed

7 files changed

+405
-192
lines changed

.github/scripts/create_stale_issues/README.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/scripts/create_stale_issues/create_stale_issues.py

Lines changed: 0 additions & 159 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Stale Component Handler
2+
3+
Handles components approaching or past their verification deadline.
4+
5+
## What it Does
6+
7+
1. Uses `scripts/check_component_freshness` to categorize components:
8+
- 🟡 **Warning (270-360 days)**: Creates GitHub issues to notify owners
9+
- 🔴 **Stale (>360 days)**: Creates PRs to remove the component
10+
11+
2. For **warning** components:
12+
- Creates issues with `stale-component` label
13+
- Assigns component owners (up to 10)
14+
- Includes instructions for verification
15+
16+
3. For **stale** components:
17+
- Creates a branch `remove-stale-{component-name}`
18+
- Removes the component directory
19+
- Opens a PR with `stale-component-removal` label
20+
- Adds component owners as reviewers
21+
22+
## Usage
23+
24+
```bash
25+
# Dry run (see what would be created)
26+
uv run .github/scripts/stale_component_handler/stale_component_handler.py \
27+
--repo owner/repo --dry-run
28+
29+
# Create issues and PRs
30+
GITHUB_TOKEN=ghp_xxx uv run .github/scripts/stale_component_handler/stale_component_handler.py \
31+
--repo owner/repo
32+
```
33+
34+
## Requirements
35+
36+
- `gh` CLI (pre-installed on GitHub Actions runners)
37+
- `GITHUB_TOKEN` with `issues: write`, `contents: write`, `pull-requests: write` permissions

.github/scripts/create_stale_issues/issue_body.md.j2 renamed to .github/scripts/stale_component_handler/issue_body.md.j2

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Component Verification Required
22

3-
The component **{{ name }}** has not been verified in {{ age_days }} days and needs attention.
3+
The component **{{ name }}** has not been verified in {{ age_days }} days and is approaching the staleness threshold.
4+
5+
**If not verified within the next {{ 360 - age_days }} days, a PR will be created to remove this component.**
46

57
| Field | Value |
68
|-------------------------|---------------------|
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Stale Component Removal
2+
3+
This PR removes the component **{{ name }}** which has not been verified in {{ age_days }} days.
4+
5+
| Field | Value |
6+
|-------------------------|---------------------|
7+
| Path | `{{ path }}` |
8+
| Last Verified | {{ last_verified }} |
9+
| Days Since Verification | {{ age_days }} |
10+
11+
### Maintainers
12+
13+
{{ owners_mention }}
14+
15+
### Why This PR Was Created
16+
17+
Components must be verified at least once per year to ensure they remain functional and compatible with current KFP versions. This component has exceeded the staleness threshold and no verification was performed.
18+
19+
### Before Merging
20+
21+
If this component should be kept:
22+
1. Close this PR
23+
2. Verify the component still works
24+
3. Update `lastVerified` in `{{ path }}/metadata.yaml`
25+
4. Submit a PR with the updated metadata
26+
27+
If this component should be removed:
28+
1. Review the changes
29+
2. Approve and merge this PR

0 commit comments

Comments
 (0)