Skip to content

Automatically remove outdated generated sources preview branches #946

Open
@koperagen

Description

@koperagen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    infrastructureGitHub actions, Gradle Scripts, Writerside, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions