From 22c5b08b189c93c539b0fe2634ecd2cb3da5c9f9 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 3 Apr 2024 19:12:27 -0400 Subject: [PATCH] Add more Signed-off-by: Peter Zhu --- .github/workflows/add-untriaged.yml | 19 --------------- .github/workflows/automerge.yml | 0 .github/workflows/backport.yml | 21 +++++++++-------- .github/workflows/delete_merged_branch.yml | 22 ------------------ .github/workflows/encoding-check.yml | 27 ---------------------- .github/workflows/jekyll-build.yml | 16 ------------- .github/workflows/link-checker.yml | 26 --------------------- .github/workflows/vale.yml | 24 ------------------- 8 files changed, 12 insertions(+), 143 deletions(-) delete mode 100644 .github/workflows/add-untriaged.yml create mode 100644 .github/workflows/automerge.yml delete mode 100644 .github/workflows/delete_merged_branch.yml delete mode 100644 .github/workflows/encoding-check.yml delete mode 100644 .github/workflows/jekyll-build.yml delete mode 100644 .github/workflows/link-checker.yml delete mode 100644 .github/workflows/vale.yml diff --git a/.github/workflows/add-untriaged.yml b/.github/workflows/add-untriaged.yml deleted file mode 100644 index 9dcc7020d24..00000000000 --- a/.github/workflows/add-untriaged.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Apply 'untriaged' label during issue lifecycle - -on: - issues: - types: [opened, reopened, transferred] - -jobs: - apply-label: - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['untriaged'] - }) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml new file mode 100644 index 00000000000..e69de29bb2d diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 92f107839cc..a54e9ccaef4 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -34,17 +34,20 @@ jobs: # opensearch-trigger-bot installation ID installation_id: 22958780 - - name: Backport - uses: VachaShah/backport@v2.1.0 - with: - github_token: ${{ steps.github_app_token.outputs.token }} - head_template: backport/backport-<%= number %>-to-<%= base %> +# - name: Backport +# uses: VachaShah/backport@v2.1.0 +# 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 + - name: Label new backport PR with backport-automerge label and approve run: | + PR_REPO="opensearch-project/documentation-website" 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"` + 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 opensearch-project/documentation-website $PR_NUMBER --add-label backport-automerge + gh issue edit -R $PR_REPO $PR_NUMBER --add-label backport-automerge + echo "Auto approve $PR_REPO PR #$PR_NUMBE with opensearch-trigger-bot" + gh pr review -R $PR_REPO $PR_NUMBER --approve env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ steps.github_app_token.outputs.token }} diff --git a/.github/workflows/delete_merged_branch.yml b/.github/workflows/delete_merged_branch.yml deleted file mode 100644 index f6fc3f28284..00000000000 --- a/.github/workflows/delete_merged_branch.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Delete merged branch of the PRs -on: - pull_request: - types: - - closed - -jobs: - delete-branch: - runs-on: ubuntu-latest - if: | - 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.') }} && - ${{ !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 }} diff --git a/.github/workflows/encoding-check.yml b/.github/workflows/encoding-check.yml deleted file mode 100644 index ade95e5f37c..00000000000 --- a/.github/workflows/encoding-check.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Encoding Checker - -on: [pull_request] - -jobs: - encoding-checker: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Check for possible file that does not follow utf-8 encoding - run: | - set +e - IFS=$(echo -en "\n\b") - COUNTER=0 - for i in `find . -type f \( -name "*.txt" -o -name "*.md" -o -name "*.markdown" -o -name "*.html" \) | grep -vE "^./.git"`; - do - grep -axv '.*' "$i" - if [ "$?" -eq 0 ]; then - echo -e "######################\n$i\n######################" - COUNTER=$(( COUNTER + 1 )) - fi - done - if [ "$COUNTER" != 0 ]; then - echo "Found files that is not following utf-8 encoding, exit 1" - exit 1 - fi diff --git a/.github/workflows/jekyll-build.yml b/.github/workflows/jekyll-build.yml deleted file mode 100644 index deb574d6f14..00000000000 --- a/.github/workflows/jekyll-build.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Jekyll Build Verification - -on: [pull_request] - -jobs: - check: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.2' - bundler-cache: true - - run: | - JEKYLL_FATAL_LINK_CHECKER=internal bundle exec jekyll build --future diff --git a/.github/workflows/link-checker.yml b/.github/workflows/link-checker.yml deleted file mode 100644 index 2e8c63a8881..00000000000 --- a/.github/workflows/link-checker.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check Links -on: - workflow_dispatch: - schedule: - - cron: "30 11 * * 0" -jobs: - check: - if: github.repository == 'opensearch-project/documentation-website' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - run: | - JEKYLL_FATAL_LINK_CHECKER=all bundle exec jekyll build --future - - name: Create Issue On Build Failure - if: ${{ failure() }} - uses: dblock/create-a-github-issue@v3 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - WORKFLOW_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - with: - update_existing: true - filename: .github/ISSUE_TEMPLATE/broken_links.md diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml deleted file mode 100644 index 515d9741330..00000000000 --- a/.github/workflows/vale.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Style check - -on: - pull_request: - workflow_dispatch: - -jobs: - style-job: - runs-on: ubuntu-latest - steps: - - name: Check out - uses: actions/checkout@v3 - - - name: Run Vale - uses: errata-ai/vale-action@reviewdog - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - with: - fail_on_error: false - reporter: github-pr-check - filter_mode: added - vale_flags: "--no-exit" - version: 2.28.0 - continue-on-error: true