Kotlin / Kotlin/dataframe

Automatically remove outdated generated sources preview branches

Open
#946 0 comments 2 reactions 0 assignees View on GitHub
infrastructure
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

After PR is merged or closed, we can trigger a task that will remove all matching source preview branches.
To detect matching branches, `build_preview_generated_code` should include some identifier related to PR in their names.
Something like `branch_name=generated-sources/docs-update-${{ github.event.number }}-${{ github.run_number }}`
https://stackoverflow.com/questions/59077079/how-to-get-pull-request-number-within-github-actions-workflow

and removing them:
```
branch_prefix="generated-sources/docs-update-${{ github.event.number }}"
for branch in $(git branch -r | grep "$branch_prefix"); do
branch_name=${branch#origin/}
git push origin --delete "$branch_name"
done
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the GitHub Actions task named build_preview_generated_code and the workflow triggered when a pull request is merged or closed. Read how preview branch names are currently generated, then verify the cleanup task can identify matching branches and delete them safely. Done means outdated generated-sources preview branches are removed after the related pull request ends.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, kotlin
Domain
build-system, ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.