Skip to content

Commit

Permalink
Initial changes add backport automerge label (opensearch-project#6865)
Browse files Browse the repository at this point in the history
* Add a label to backport PRs in preparation for backport automerge

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

* Small tweaks

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

---------

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon authored Apr 3, 2024
1 parent e9ff189 commit afa4d27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged
&& github.repository == 'opensearch-project/documentation-website'
&& (
github.event.action == 'closed'
|| (
Expand All @@ -38,3 +39,12 @@ jobs:
with:
github_token: ${{ steps.github_app_token.outputs.token }}
head_template: backport/backport-<%= number %>-to-<%= base %>

- name: Label new backport PR with backport-automerge label
run: |
PR_BRANCH=backport/backport-<%= number %>-to-<%= base %>
PR_NUMBER=`gh pr list -R opensearch-project/documentation-website --json "number,headRefName" --state open | jq -r ".[] | select(.headRefName == \"$PR_BRANCH\") | .number"`
echo "Update Backport PR #$PR_NUMBER on branch $PR_BRANCH with backport-automerge label"
gh issue edit -R opensearch-project/documentation-website $PR_NUMBER --add-label backport-automerge
env:
GH_TOKEN: ${{ steps.github_app_token.outputs.token }}
2 changes: 1 addition & 1 deletion .github/workflows/delete_merged_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
delete-branch:
runs-on: ubuntu-latest
if: |
startsWith(github.event.pull_request.head.repo.full_name, 'opensearch-project/documentation-website') &&
github.repository == '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.') }} &&
Expand Down

0 comments on commit afa4d27

Please sign in to comment.