Skip to content

Add Automerge Workflow with other smaller fixes #6892

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

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/automerge-backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Automerge Backport
on:
pull_request:
pull_request_review:
types:
- submitted
check_suite:
types:
- completed
status: {}
jobs:
automerge-backport:
if: |
github.repository == 'opensearch-project/documentation-website' &&
startsWith(github.event.pull_request.head.ref, 'backport/')
runs-on: ubuntu-latest
steps:
- name: Wait some time so that label and approval is up
run: sleep 30
- id: automerge
name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "backport-automerge,!On hold"
MERGE_FILTER_AUTHOR: "opensearch-trigger-bot[bot]"
MERGE_REQUIRED_APPROVALS: "1"
MERGE_RETRIES: "20"
MERGE_RETRY_SLEEP: "10000"
MERGE_ERROR_FAIL: "true"
MERGE_FORKS: "false"
MERGE_METHOD: "squash"
MERGE_DELETE_BRANCH: "true"
21 changes: 17 additions & 4 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,22 @@ jobs:

- name: Label new backport PR with backport-automerge label
run: |
PR_BRANCH=backport/backport-${{ github.event.pull_request.number }}-to-`echo ${{ github.event.label.name }} | cut -d ' ' -f2`
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
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'`
echo $PR_LABELS
OLDIFS=$IFS
export IFS=','
for label in $PR_LABELS
do
if [[ "$label" == "backport"* ]]; then
echo "Found label \"$label\""
PR_REPO="opensearch-project/documentation-website"
PR_BRANCH=backport/backport-${{ github.event.pull_request.number }}-to-`echo $label | cut -d ' ' -f2`
PR_NUMBER=`gh pr list -R $PR_REPO --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 $PR_REPO $PR_NUMBER --add-label backport-automerge
echo "Auto approve $PR_REPO PR #$PR_NUMBER with opensearch-trigger-bot"
gh pr review -R $PR_REPO $PR_NUMBER --approve
fi
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/jekyll-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Jekyll Build Verification
on: [pull_request]

jobs:
check:
jekyll-build:
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/link-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
schedule:
- cron: "30 11 * * 0"
jobs:
check:
link-checker:
if: github.repository == 'opensearch-project/documentation-website'
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vale.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Style check
name: Style Check

on:
pull_request:
Expand Down
Loading