diff --git a/.github/workflows/delete_backport_branch.yml b/.github/workflows/delete_backport_branch.yml deleted file mode 100644 index 387a124b8c..0000000000 --- a/.github/workflows/delete_backport_branch.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Delete merged branch of the backport PRs -on: - pull_request: - types: - - closed - -jobs: - delete-branch: - runs-on: ubuntu-latest - if: startsWith(github.event.pull_request.head.ref,'backport/') - steps: - - name: Delete merged branch - uses: SvanBoxel/delete-merged-branch@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/delete_merged_branch.yml b/.github/workflows/delete_merged_branch.yml new file mode 100644 index 0000000000..8972c1144a --- /dev/null +++ b/.github/workflows/delete_merged_branch.yml @@ -0,0 +1,22 @@ +name: Delete merged branch of the PRs +on: + pull_request: + types: + - closed + +jobs: + delete-branch: + runs-on: ubuntu-latest + if: | + startsWith(github.event.pull_request.head.repo.full_name, 'opensearch-project/documentation-website') && + startsWith(! github.event.pull_request.head.ref, 'main') && + startsWith(! github.event.pull_request.head.ref, '1.') && + startsWith(! github.event.pull_request.head.ref, '2.') && + startsWith(! github.event.pull_request.head.ref, 'version/') + steps: + - name: Echo remove branch + run: echo Removing ${{github.event.pull_request.head.ref}} + - name: Delete merged branch + uses: SvanBoxel/delete-merged-branch@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}