Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically remove outdated generated sources preview branches #946

Open
koperagen opened this issue Nov 8, 2024 · 0 comments
Open

Automatically remove outdated generated sources preview branches #946

koperagen opened this issue Nov 8, 2024 · 0 comments
Labels
infrastructure GitHub actions, Gradle Scripts, Writerside, etc.

Comments

@koperagen
Copy link
Collaborator

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
@koperagen koperagen added the infrastructure GitHub actions, Gradle Scripts, Writerside, etc. label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure GitHub actions, Gradle Scripts, Writerside, etc.
Projects
None yet
Development

No branches or pull requests

1 participant