Skip to content

Commit 408c27e

Browse files
Add Automerge Workflow with other smaller fixes (#6892)
* Add Automerge Workflow with other smaller fixes Signed-off-by: Peter Zhu <[email protected]> * Add Automerge Workflow with other smaller fixes Signed-off-by: Peter Zhu <[email protected]> --------- Signed-off-by: Peter Zhu <[email protected]> (cherry picked from commit 4333bc3) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 5b26269 commit 408c27e

File tree

5 files changed

+53
-7
lines changed

5 files changed

+53
-7
lines changed

Diff for: .github/workflows/automerge-backport.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Automerge Backport
2+
on:
3+
pull_request:
4+
pull_request_review:
5+
types:
6+
- submitted
7+
check_suite:
8+
types:
9+
- completed
10+
status: {}
11+
jobs:
12+
automerge-backport:
13+
if: |
14+
github.repository == 'opensearch-project/documentation-website' &&
15+
startsWith(github.event.pull_request.head.ref, 'backport/')
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Wait some time so that label and approval is up
19+
run: sleep 30
20+
- id: automerge
21+
name: automerge
22+
uses: "pascalgn/[email protected]"
23+
env:
24+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
25+
MERGE_LABELS: "backport-automerge,!On hold"
26+
MERGE_FILTER_AUTHOR: "opensearch-trigger-bot[bot]"
27+
MERGE_REQUIRED_APPROVALS: "1"
28+
MERGE_RETRIES: "20"
29+
MERGE_RETRY_SLEEP: "10000"
30+
MERGE_ERROR_FAIL: "true"
31+
MERGE_FORKS: "false"
32+
MERGE_METHOD: "squash"
33+
MERGE_DELETE_BRANCH: "true"

Diff for: .github/workflows/backport.yml

+17-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,22 @@ jobs:
4242

4343
- name: Label new backport PR with backport-automerge label
4444
run: |
45-
PR_BRANCH=backport/backport-${{ github.event.pull_request.number }}-to-`echo ${{ github.event.label.name }} | cut -d ' ' -f2`
46-
PR_NUMBER=`gh pr list -R opensearch-project/documentation-website --json "number,headRefName" --state open | jq -r ".[] | select(.headRefName == \"$PR_BRANCH\") | .number"`
47-
echo "Update Backport PR '#$PR_NUMBER' on branch '$PR_BRANCH' with 'backport-automerge' label"
48-
gh issue edit -R opensearch-project/documentation-website $PR_NUMBER --add-label backport-automerge
45+
PR_LABELS=`echo "${{ toJson(github.event.pull_request.labels.*.name) }}" | sed -e 's/\[//g;s/\]//g;s/^\s*//g;s/\s*$//g' | tr -d '\n'`
46+
echo $PR_LABELS
47+
OLDIFS=$IFS
48+
export IFS=','
49+
for label in $PR_LABELS
50+
do
51+
if [[ "$label" == "backport"* ]]; then
52+
echo "Found label \"$label\""
53+
PR_REPO="opensearch-project/documentation-website"
54+
PR_BRANCH=backport/backport-${{ github.event.pull_request.number }}-to-`echo $label | cut -d ' ' -f2`
55+
PR_NUMBER=`gh pr list -R $PR_REPO --json "number,headRefName" --state open | jq -r ".[] | select(.headRefName == \"$PR_BRANCH\") | .number"`
56+
echo "Update Backport PR '#$PR_NUMBER' on branch '$PR_BRANCH' with 'backport-automerge' label"
57+
gh issue edit -R $PR_REPO $PR_NUMBER --add-label backport-automerge
58+
echo "Auto approve $PR_REPO PR #$PR_NUMBER with opensearch-trigger-bot"
59+
gh pr review -R $PR_REPO $PR_NUMBER --approve
60+
fi
61+
done
4962
env:
5063
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/jekyll-build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Jekyll Build Verification
33
on: [pull_request]
44

55
jobs:
6-
check:
6+
jekyll-build:
77
runs-on: ubuntu-latest
88

99
steps:

Diff for: .github/workflows/link-checker.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
schedule:
55
- cron: "30 11 * * 0"
66
jobs:
7-
check:
7+
link-checker:
88
if: github.repository == 'opensearch-project/documentation-website'
99
runs-on: ubuntu-latest
1010
steps:

Diff for: .github/workflows/vale.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Style check
1+
name: Style Check
22

33
on:
44
pull_request:

0 commit comments

Comments
 (0)