From ca38d59b36698b629e7b280272698557d4098700 Mon Sep 17 00:00:00 2001 From: bitliu Date: Thu, 7 Dec 2023 11:15:24 +0800 Subject: [PATCH 1/6] feat: support docs preview Signed-off-by: bitliu --- .github/workflows/docs.yaml | 49 ++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 7bda29e66a0..78757414ab9 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -6,12 +6,8 @@ on: - "release/v*" paths-ignore: - "**/*.png" - pull_request: - branches: - - "main" - - "release/v*" - paths-ignore: - - "**/*.png" + pull_request_target: + types: [opened, synchronize, reopened] jobs: docs-lint: @@ -19,6 +15,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Run markdown linter uses: nosborn/github-action-markdown-cli@v3.3.0 @@ -36,6 +34,7 @@ jobs: uses: actions/checkout@v4 with: submodules: true + ref: ${{ github.event.pull_request.head.sha }} - name: Setup Hugo uses: peaceiris/actions-hugo@v2 @@ -60,6 +59,44 @@ jobs: # Duration after which artifact will expire in days. # retention-days: # optional, default is 1 + docs-preview: + if: "github.event_name == 'pull_request_target'" + needs: docs-build + runs-on: ubuntu-22.04 + steps: + - name: Git checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: 'latest' + extended: true + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: '18' + - name: Install Site Dependencies and Build Site + run: make docs + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v2.0 + with: + publish-dir: 'site/public' + production-deploy: false + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Deploy from GitHub Actions" + alias: "${{ github.event.repository.name }}-pr-${{ github.event.pull_request.number }}-preview" + # these all default to 'true' + enable-pull-request-comment: true + enable-commit-comment: false + enable-commit-status: true + overwrites-pull-request-comment: true + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + timeout-minutes: 1 + # This workflow contains a single job called "build" docs-publish: if: github.event_name == 'push' From 56acd6fda7606e5fe01484d2cec246f3ffc7595a Mon Sep 17 00:00:00 2001 From: bitliu Date: Thu, 7 Dec 2023 11:28:56 +0800 Subject: [PATCH 2/6] test: update eg about page Signed-off-by: bitliu --- site/content/en/about/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/en/about/index.md b/site/content/en/about/index.md index accb967eecc..1c7caf9556c 100644 --- a/site/content/en/about/index.md +++ b/site/content/en/about/index.md @@ -1,5 +1,5 @@ --- -title: About Envoy Gateway +title: About Envoy Gateway Page linkTitle: About --- From de6e537fe715e256b1b2df58052b4fd5e30bf846 Mon Sep 17 00:00:00 2001 From: bitliu Date: Thu, 7 Dec 2023 11:28:56 +0800 Subject: [PATCH 3/6] test: update eg about page Signed-off-by: bitliu --- site/content/en/about/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/content/en/about/index.md b/site/content/en/about/index.md index accb967eecc..1c7caf9556c 100644 --- a/site/content/en/about/index.md +++ b/site/content/en/about/index.md @@ -1,5 +1,5 @@ --- -title: About Envoy Gateway +title: About Envoy Gateway Page linkTitle: About --- From 13849d0004cc5aa3f938f78eb25584d5626ec034 Mon Sep 17 00:00:00 2001 From: bitliu Date: Thu, 7 Dec 2023 16:29:12 +0800 Subject: [PATCH 4/6] feat: support auto assign reviewers Signed-off-by: bitliu --- .github/workflows/auto_assign.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/auto_assign.yaml diff --git a/.github/workflows/auto_assign.yaml b/.github/workflows/auto_assign.yaml new file mode 100644 index 00000000000..d2032098439 --- /dev/null +++ b/.github/workflows/auto_assign.yaml @@ -0,0 +1,17 @@ +name: Auto Request Review + +on: + pull_request_target: + types: [opened, reopened, synchronize] + +jobs: + request-review: + runs-on: ubuntu-latest + steps: + - name: Request review from team + uses: peter-evans/create-pull-request-review@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + review-request-team: 'gateway-reviewers' + repository: ${{ github.repository }} + pull-request-number: ${{ github.event.pull_request.number }} From 4477656a90b35b9f800862f461409de22dc39eec Mon Sep 17 00:00:00 2001 From: bitliu Date: Thu, 7 Dec 2023 16:35:48 +0800 Subject: [PATCH 5/6] feat: support auto assign reviewers Signed-off-by: bitliu --- .github/workflows/auto_assign.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/auto_assign.yaml b/.github/workflows/auto_assign.yaml index d2032098439..088e0c21f04 100644 --- a/.github/workflows/auto_assign.yaml +++ b/.github/workflows/auto_assign.yaml @@ -5,13 +5,20 @@ on: types: [opened, reopened, synchronize] jobs: - request-review: + auto-request-review: runs-on: ubuntu-latest steps: - name: Request review from team - uses: peter-evans/create-pull-request-review@v1 + uses: actions/github-script@v6 with: - token: ${{ secrets.GITHUB_TOKEN }} - review-request-team: 'gateway-reviewers' - repository: ${{ github.repository }} - pull-request-number: ${{ github.event.pull_request.number }} + script: | + const github = require('@actions/github'); + const context = github.context; + const pullRequestNumber = context.payload.pull_request.number; + const repo = context.repo; + await github.rest.pulls.requestReviewers({ + ...repo, + pull_number: pullRequestNumber, + reviewers: ['Xunzhuo'] + }); + github-token: ${{ secrets.GITHUB_TOKEN }} From d232eadab209753f79de097e3a200a115ebb394c Mon Sep 17 00:00:00 2001 From: bitliu Date: Thu, 7 Dec 2023 16:37:51 +0800 Subject: [PATCH 6/6] feat: support auto assign reviewers Signed-off-by: bitliu --- .github/workflows/auto_assign.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto_assign.yaml b/.github/workflows/auto_assign.yaml index 088e0c21f04..7e69b8dc0b8 100644 --- a/.github/workflows/auto_assign.yaml +++ b/.github/workflows/auto_assign.yaml @@ -12,12 +12,10 @@ jobs: uses: actions/github-script@v6 with: script: | - const github = require('@actions/github'); - const context = github.context; const pullRequestNumber = context.payload.pull_request.number; - const repo = context.repo; await github.rest.pulls.requestReviewers({ - ...repo, + owner: context.repo.owner, + repo: context.repo.repo, pull_number: pullRequestNumber, reviewers: ['Xunzhuo'] });