From f138b866be5af613fc70ae768697dd0948c66b47 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 28 Nov 2024 14:08:19 +0100 Subject: [PATCH 01/26] add new function --- seth/config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/seth/config.go b/seth/config.go index f992bbee5..29d836470 100644 --- a/seth/config.go +++ b/seth/config.go @@ -15,6 +15,10 @@ import ( "github.com/pkg/errors" ) +func MyAmazingNewFunction() string { + return "bla bla bla" +} + const ( ErrReadSethConfig = "failed to read TOML config for seth" ErrUnmarshalSethConfig = "failed to unmarshal TOML config for seth" From f3ab3c8eaaa9f756b4acb77f2e130a2bd69574b3 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 28 Nov 2024 14:47:17 +0100 Subject: [PATCH 02/26] use GATI --- .github/workflows/generate-go-docs.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 80784494e..29d950bd3 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -9,14 +9,18 @@ on: jobs: generate_docs_new_pr: - if: ${{ github.event.pull_request.labels || contains(github.event.issue.labels.*.name, 'generate_go_docs') }} + if: ${{ github.event.pull_request.labels && contains(github.event.issue.labels.*.name, 'generate_go_docs') }} runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - repository-projects: read steps: + - name: Setup GitHub Token + id: setup-github-token + uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 + with: + aws-role-arn: ${{ secrets.AWS_ROLE_ARN_FOR_GO_DOC_GENERATION }} + aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Checkout current branch uses: actions/checkout@v3 with: @@ -69,7 +73,7 @@ jobs: git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs - name: Create a new PR targeting current PR - uses: peter-evans/create-pull-request@v5 + uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} base: ${{ env.pr_branch }} From 4a214a6ee8e10e4b05bfa84a86fcde54d4d034d2 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 16:48:29 +0100 Subject: [PATCH 03/26] update generate go doc workflow with correct ARN roles --- .github/workflows/generate-go-docs.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 29d950bd3..3ee68196a 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -13,11 +13,11 @@ jobs: runs-on: ubuntu-latest steps: - - name: Setup GitHub Token + - name: Setup GitHub Token for reading Generate Go Doc Repo id: setup-github-token uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 with: - aws-role-arn: ${{ secrets.AWS_ROLE_ARN_FOR_GO_DOC_GENERATION }} + aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }} aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} aws-region: ${{ secrets.AWS_REGION }} @@ -72,6 +72,14 @@ jobs: git commit -m "Add automatically generated go documentation" git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs + - name: Setup GitHub Token for creating a new PR + id: setup-github-token + uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 + with: + aws-role-arn: ${{ secrets.AWS_ROLE_ARN_CREATE_PR }} + aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Create a new PR targeting current PR uses: peter-evans/create-pull-request@v7 with: From 1ce7e0d7106427c112d1a15bbf3330b6a44e2c49 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 17:00:18 +0100 Subject: [PATCH 04/26] update trigger condition --- .github/workflows/generate-go-docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index dc9cedee9..a6ede4893 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -9,7 +9,7 @@ on: jobs: generate_docs_new_pr: - if: ${{ contains(github.event.issue.labels.*.name, 'generate_go_docs') }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }} runs-on: ubuntu-latest steps: From c3dfa8130d7dbc78be5aad328db7cef07991a6f4 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 17:05:58 +0100 Subject: [PATCH 05/26] add id token permissions --- .github/workflows/generate-go-docs.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index a6ede4893..977aaeb20 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -11,6 +11,9 @@ jobs: generate_docs_new_pr: if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }} runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Setup GitHub Token for reading Generate Go Doc Repo From 1185c7e27a10bc381dd7310e5bd44f488a59e6e8 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:16:25 +0100 Subject: [PATCH 06/26] set GOPRIVATE --- .github/workflows/generate-go-docs.yaml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 977aaeb20..4bbe4c3b2 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -29,6 +29,18 @@ jobs: with: fetch-depth: 0 + - name: Configure git for private repository and install go doc generator + env: + GOPRIVATE: github.com/smartcontractkit/generate-go-function + run: | + git config --global url.ssh://git@github.com/.insteadOf https://github.com/ + go install github.com/smartcontractkit/generate-go-function-docs@latest + + - name: Install gopls + shell: bash + run: | + go install golang.org/x/tools/gopls@latest + - name: Setup Git run: | git config user.name "github-actions[bot]" @@ -42,16 +54,6 @@ jobs: echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT echo "head_commit=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT - - name: Install go doc generator - shell: bash - run: | - go install github.com/smartcontractkit/generate-go-function-docs@latest - - - name: Install gopls - shell: bash - run: | - go install golang.org/x/tools/gopls@latest - - name: Create a new branch run: | git checkout -b ${{ steps.pr-details.outputs.pr_branch }}-docs From 5e74d9a725a0e7a5893b3cf1afd7de0a9a36f065 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:18:59 +0100 Subject: [PATCH 07/26] try with token --- .github/workflows/generate-go-docs.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 4bbe4c3b2..5f36051b5 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -32,8 +32,9 @@ jobs: - name: Configure git for private repository and install go doc generator env: GOPRIVATE: github.com/smartcontractkit/generate-go-function + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git config --global url.ssh://git@github.com/.insteadOf https://github.com/ + git config --global url."https://$GITHUB_TOKEN@github.com/".insteadOf "https://github.com/" go install github.com/smartcontractkit/generate-go-function-docs@latest - name: Install gopls From 78da84cc0b44e4368796e39906d844af0f38f5cc Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:22:56 +0100 Subject: [PATCH 08/26] try x-access-token way --- .github/workflows/generate-go-docs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 5f36051b5..ff4aec2fe 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -32,9 +32,9 @@ jobs: - name: Configure git for private repository and install go doc generator env: GOPRIVATE: github.com/smartcontractkit/generate-go-function - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git config --global url."https://$GITHUB_TOKEN@github.com/".insteadOf "https://github.com/" + git config --global \ + url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" go install github.com/smartcontractkit/generate-go-function-docs@latest - name: Install gopls From ea73bb9ee9a075ad26dfa665423de3aa581f6291 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:29:48 +0100 Subject: [PATCH 09/26] fix GOPRIVATE --- .github/workflows/generate-go-docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index ff4aec2fe..af9f10983 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -31,7 +31,7 @@ jobs: - name: Configure git for private repository and install go doc generator env: - GOPRIVATE: github.com/smartcontractkit/generate-go-function + GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs run: | git config --global \ url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" From 1dd3be28a61f9ebd5358f4de81ad6ed7f0a1b951 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:36:34 +0100 Subject: [PATCH 10/26] fix PR-related data parsing --- .github/workflows/generate-go-docs.yaml | 40 +++++++++++-------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index af9f10983..6dccb8ec7 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -24,11 +24,6 @@ jobs: aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} aws-region: ${{ secrets.AWS_REGION }} - - name: Checkout current branch - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Configure git for private repository and install go doc generator env: GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs @@ -42,41 +37,40 @@ jobs: run: | go install golang.org/x/tools/gopls@latest - - name: Setup Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + - name: Checkout current branch + uses: actions/checkout@v3 + with: + fetch-depth: 0 - - name: Get PR details - id: pr-details + - name: Setup Git to use GitHub Actions bot run: | - echo "pr_number=$(jq -r .pull_request.number <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT - echo "pr_branch=$(jq -r .pull_request.head.ref <<< "$GITHUB_EVENT_PATH")" >> $GITHUB_OUTPUT - echo "base_commit=${{ github.event.pull_request.base.sha }}" >> $GITHUB_OUTPUT - echo "head_commit=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" - name: Create a new branch run: | - git checkout -b ${{ steps.pr-details.outputs.pr_branch }}-docs + git checkout -b ${{ github.event.pull_request.head.ref }}-docs - name: Generate go docs shell: bash env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} run: | - generate-go-function-docs diff -b ${{ steps.pr-details.outputs.base_commit }} -c ${{ steps.pr-details.outputs.head_commit }} -g fake_slash + # Add go binary to PATH + PATH=$PATH:$(go env GOPATH)/bin + export PATH + generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash - name: Make sure code still compiles run: | go mod tidy - go mod vendor go build ./... - name: Commit changes run: | git add . git commit -m "Add automatically generated go documentation" - git push origin ${{ steps.pr-details.outputs.pr_branch }}-docs + git push origin ${{ github.event.pull_request.head.ref }}-docs - name: Setup GitHub Token for creating a new PR id: setup-github-token-write @@ -90,7 +84,7 @@ jobs: uses: peter-evans/create-pull-request@v7 with: token: ${{ secrets.GITHUB_TOKEN }} - base: ${{ env.pr_branch }} - branch: ${{ steps.pr-details.outputs.pr_branch }}-docs - title: "Go docs for PR#${{ env.pr_number }}" - body: "This PR contains automatically generated go documentation for the PR#${{ env.pr_number }}. Please review the changes." + base: ${{ github.event.pull_request.head.ref }} + branch: ${{ github.event.pull_request.head.ref }}-docs + title: "Go docs for PR#${{ github.event.pull_request.number }}" + body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes." From 8b678dec62c8c565669fb38976beb64475d2fd0d Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:45:12 +0100 Subject: [PATCH 11/26] temporary fix to folder flag --- .github/workflows/generate-go-docs.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 6dccb8ec7..6b162e70c 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -58,8 +58,9 @@ jobs: run: | # Add go binary to PATH PATH=$PATH:$(go env GOPATH)/bin - export PATH - generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash + export PATH + # TODO check why this flag is needed, if it has a default! + generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash -f . - name: Make sure code still compiles run: | From a45dd6b059a15babbd975ecfa1677a72b072c072 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Tue, 3 Dec 2024 18:48:51 +0100 Subject: [PATCH 12/26] run generation for seth --- .github/workflows/generate-go-docs.yaml | 45 ++++++++++++++++++++----- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 6b162e70c..d88d42dc2 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -60,32 +60,59 @@ jobs: PATH=$PATH:$(go env GOPATH)/bin export PATH # TODO check why this flag is needed, if it has a default! - generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash -f . + # TODO we need a way to determine which modules have changes and run this command for all of them + generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash -f ./seth --goModLocation ./seth/go.mod - name: Make sure code still compiles run: | + # TODO we need a way to determine which modules have changes and run this command for all of them + cd seth go mod tidy go build ./... - - name: Commit changes + - name: Setup branch names + id: branch-names + shell: bash run: | - git add . - git commit -m "Add automatically generated go documentation" - git push origin ${{ github.event.pull_request.head.ref }}-docs + echo "base_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + echo "new_branch=${{ github.head_ref }}-docs" >> $GITHUB_OUTPUT - name: Setup GitHub Token for creating a new PR id: setup-github-token-write uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 with: - aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }} + aws-role-arn: ${{ secrets.AWS_ROLE_ARN_CREATE_PR }} aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} aws-region: ${{ secrets.AWS_REGION }} + - name: Checkout new branch + uses: peterjgrainger/action-create-branch@10c7d268152480ae859347db45dc69086cef1d9c # v3.0.0 + env: + GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} + with: + branch: ${{ steps.branch-names.outputs.new_branch }} + + - name: Commit changes + uses: planetscale/ghcommit-action@13a844326508cdefc72235201bb0446d6d10a85f # v0.1.6 + with: + commit_message: "[Bot] Add automatically generated go documentation" + repo: ${{ github.repository }} + branch: ${{ steps.branch-names.outputs.new_branch }} + # TODO we need a way to determine which modules have changes and run this command for all of them + file_pattern: "seth/*" + env: + GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} + + - name: Fetch repository changes + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Create a new PR targeting current PR uses: peter-evans/create-pull-request@v7 with: - token: ${{ secrets.GITHUB_TOKEN }} - base: ${{ github.event.pull_request.head.ref }} - branch: ${{ github.event.pull_request.head.ref }}-docs + token: ${{ steps.setup-github-token-write.outputs.access-token }} + base: ${{ steps.branch-names.outputs.base_branch }} + branch: ${{ steps.branch-names.outputs.new_branch }} title: "Go docs for PR#${{ github.event.pull_request.number }}" body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes." From cdafe2aad928aea5e46d6dc41cd6639c011bdf4b Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 4 Dec 2024 10:48:52 +0100 Subject: [PATCH 13/26] try simpler flow --- .github/workflows/generate-go-docs.yaml | 61 +++++++++++++------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index d88d42dc2..fb61c188b 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -42,14 +42,14 @@ jobs: with: fetch-depth: 0 - - name: Setup Git to use GitHub Actions bot - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + # - name: Setup Git to use GitHub Actions bot + # run: | + # git config user.name "github-actions[bot]" + # git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Create a new branch - run: | - git checkout -b ${{ github.event.pull_request.head.ref }}-docs + # - name: Create a new branch + # run: | + # git checkout -b ${{ github.event.pull_request.head.ref }}-docs - name: Generate go docs shell: bash @@ -85,34 +85,35 @@ jobs: aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} aws-region: ${{ secrets.AWS_REGION }} - - name: Checkout new branch - uses: peterjgrainger/action-create-branch@10c7d268152480ae859347db45dc69086cef1d9c # v3.0.0 - env: - GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} - with: - branch: ${{ steps.branch-names.outputs.new_branch }} - - - name: Commit changes - uses: planetscale/ghcommit-action@13a844326508cdefc72235201bb0446d6d10a85f # v0.1.6 - with: - commit_message: "[Bot] Add automatically generated go documentation" - repo: ${{ github.repository }} - branch: ${{ steps.branch-names.outputs.new_branch }} - # TODO we need a way to determine which modules have changes and run this command for all of them - file_pattern: "seth/*" - env: - GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} - - - name: Fetch repository changes - uses: actions/checkout@v3 - with: - fetch-depth: 0 + # - name: Checkout new branch + # uses: peterjgrainger/action-create-branch@10c7d268152480ae859347db45dc69086cef1d9c # v3.0.0 + # env: + # GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} + # with: + # branch: ${{ steps.branch-names.outputs.new_branch }} + + # - name: Commit changes + # uses: planetscale/ghcommit-action@13a844326508cdefc72235201bb0446d6d10a85f # v0.1.6 + # with: + # commit_message: "[Bot] Add automatically generated go documentation" + # repo: ${{ github.repository }} + # branch: ${{ steps.branch-names.outputs.new_branch }} + # # TODO we need a way to determine which modules have changes and run this command for all of them + # file_pattern: "seth/*" + # env: + # GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} + + # - name: Fetch repository changes + # uses: actions/checkout@v3 + # with: + # fetch-depth: 0 - name: Create a new PR targeting current PR uses: peter-evans/create-pull-request@v7 with: token: ${{ steps.setup-github-token-write.outputs.access-token }} - base: ${{ steps.branch-names.outputs.base_branch }} branch: ${{ steps.branch-names.outputs.new_branch }} + base: ${{ steps.branch-names.outputs.base_branch }} title: "Go docs for PR#${{ github.event.pull_request.number }}" body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes." + commit-message: "[Bot] Add automatically generated go documentation" From 937b13d0192610a5057ca7b9233a25988d989593 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 09:44:54 +0100 Subject: [PATCH 14/26] simplify pipeline --- .github/workflows/generate-go-docs.yaml | 52 +++++-------------------- 1 file changed, 10 insertions(+), 42 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index fb61c188b..94eac8061 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -42,15 +42,6 @@ jobs: with: fetch-depth: 0 - # - name: Setup Git to use GitHub Actions bot - # run: | - # git config user.name "github-actions[bot]" - # git config user.email "github-actions[bot]@users.noreply.github.com" - - # - name: Create a new branch - # run: | - # git checkout -b ${{ github.event.pull_request.head.ref }}-docs - - name: Generate go docs shell: bash env: @@ -61,7 +52,7 @@ jobs: export PATH # TODO check why this flag is needed, if it has a default! # TODO we need a way to determine which modules have changes and run this command for all of them - generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g fake_slash -f ./seth --goModLocation ./seth/go.mod + generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f ./seth --goModLocation ./seth/go.mod - name: Make sure code still compiles run: | @@ -70,12 +61,12 @@ jobs: go mod tidy go build ./... - - name: Setup branch names - id: branch-names - shell: bash - run: | - echo "base_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT - echo "new_branch=${{ github.head_ref }}-docs" >> $GITHUB_OUTPUT + # - name: Export branch names + # id: branch-names + # shell: bash + # run: | + # echo "base_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT + # echo "new_branch=${{ github.head_ref }}-docs" >> $GITHUB_OUTPUT - name: Setup GitHub Token for creating a new PR id: setup-github-token-write @@ -85,35 +76,12 @@ jobs: aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} aws-region: ${{ secrets.AWS_REGION }} - # - name: Checkout new branch - # uses: peterjgrainger/action-create-branch@10c7d268152480ae859347db45dc69086cef1d9c # v3.0.0 - # env: - # GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} - # with: - # branch: ${{ steps.branch-names.outputs.new_branch }} - - # - name: Commit changes - # uses: planetscale/ghcommit-action@13a844326508cdefc72235201bb0446d6d10a85f # v0.1.6 - # with: - # commit_message: "[Bot] Add automatically generated go documentation" - # repo: ${{ github.repository }} - # branch: ${{ steps.branch-names.outputs.new_branch }} - # # TODO we need a way to determine which modules have changes and run this command for all of them - # file_pattern: "seth/*" - # env: - # GITHUB_TOKEN: ${{ steps.setup-github-token-write.outputs.access-token }} - - # - name: Fetch repository changes - # uses: actions/checkout@v3 - # with: - # fetch-depth: 0 - - name: Create a new PR targeting current PR - uses: peter-evans/create-pull-request@v7 + uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 with: token: ${{ steps.setup-github-token-write.outputs.access-token }} - branch: ${{ steps.branch-names.outputs.new_branch }} - base: ${{ steps.branch-names.outputs.base_branch }} + branch: ${{ github.head_ref }}-docs + base: ${{ github.head_ref }} title: "Go docs for PR#${{ github.event.pull_request.number }}" body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes." commit-message: "[Bot] Add automatically generated go documentation" From 4fc293ba430bde7b52aae8989348d9c2e80e0f91 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 11:09:14 +0100 Subject: [PATCH 15/26] try with calling a test function --- seth/decode.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/seth/decode.go b/seth/decode.go index 737be2a38..3a0612b66 100644 --- a/seth/decode.go +++ b/seth/decode.go @@ -105,6 +105,8 @@ func (m *Client) Decode(tx *types.Transaction, txErr error) (*DecodedTransaction return nil, verr.Join(m.Errors...) } + _ = MyAmazingNewFunction() + if decodedErr := m.DecodeSendErr(txErr); decodedErr != nil { return nil, decodedErr } From ce1b5b6e977fa8ea31e30163beed030370cbc829 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 13:21:22 +0100 Subject: [PATCH 16/26] remove exports from doc gen workflow --- .github/workflows/generate-go-docs.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 94eac8061..1e1d5da8e 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -61,13 +61,6 @@ jobs: go mod tidy go build ./... - # - name: Export branch names - # id: branch-names - # shell: bash - # run: | - # echo "base_branch=${{ github.head_ref }}" >> $GITHUB_OUTPUT - # echo "new_branch=${{ github.head_ref }}-docs" >> $GITHUB_OUTPUT - - name: Setup GitHub Token for creating a new PR id: setup-github-token-write uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 From 20f2143993e90660204c462e12e10a85f8c3bb9b Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 17:08:10 +0100 Subject: [PATCH 17/26] run doc generation for all go modules --- .github/workflows/generate-go-docs.yaml | 53 +++++++++++++++---------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 1e1d5da8e..62d3ed355 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -9,11 +9,11 @@ on: jobs: generate_docs_new_pr: - if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }} runs-on: ubuntu-latest permissions: id-token: write - contents: read + contents: read steps: - name: Setup GitHub Token for reading Generate Go Doc Repo @@ -24,25 +24,39 @@ jobs: aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} aws-region: ${{ secrets.AWS_REGION }} - - name: Configure git for private repository and install go doc generator + - name: Configure git for private repository and install go tools env: GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs run: | git config --global \ url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" go install github.com/smartcontractkit/generate-go-function-docs@latest - - - name: Install gopls - shell: bash - run: | - go install golang.org/x/tools/gopls@latest + go install github.com/jmank88/gomods@v0.1.3 + go install golang.org/x/tools/gopls@latest - name: Checkout current branch uses: actions/checkout@v3 with: - fetch-depth: 0 + fetch-depth: 0 + + - name: Find all go modules + shell: bash + id: go-modules + run: | + PATH=$PATH:$(go env GOPATH)/bin + export PATH + gomods_output=$(gomods 2>&1) + + # Extract the parent directories of go.mod files + parent_folders=$(echo "$gomods_output" | grep 'go\.mod$' | sed 's/\/go\.mod//' | sed 's/^[ \t]*//;s/[ \t]*$//' | xargs -n 1) + + # Convert parent directories into a JSON matrix + echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > folders.json - - name: Generate go docs + echo "Folder List JSON" + cat folders.json + + - name: Generate go docs for all projects shell: bash env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} @@ -50,16 +64,15 @@ jobs: # Add go binary to PATH PATH=$PATH:$(go env GOPATH)/bin export PATH - # TODO check why this flag is needed, if it has a default! - # TODO we need a way to determine which modules have changes and run this command for all of them - generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f ./seth --goModLocation ./seth/go.mod - - - name: Make sure code still compiles - run: | - # TODO we need a way to determine which modules have changes and run this command for all of them - cd seth - go mod tidy - go build ./... + cat folders.json | jq -c '.[]' | while read -r item; do + folder=$(echo "$item" | jq -r '.folder') + echo "Processing folder: $folder" + generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f "$folder" + cd "$folder" + echo "Checking if code still compiles" + go build ./... + cd - + done - name: Setup GitHub Token for creating a new PR id: setup-github-token-write From d0b3ee429cfcdd3e1d49c29a27d9a1e2711859df Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 17:18:00 +0100 Subject: [PATCH 18/26] only generate docs, don't compile (takes too long) --- .github/workflows/generate-go-docs.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 62d3ed355..5d5eb7278 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -69,8 +69,6 @@ jobs: echo "Processing folder: $folder" generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f "$folder" cd "$folder" - echo "Checking if code still compiles" - go build ./... cd - done From 92afb4e0f6496ea700905aa8a9393a82afb3c36e Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 17:23:47 +0100 Subject: [PATCH 19/26] remove folders.json --- .github/workflows/generate-go-docs.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 5d5eb7278..2a0e742b8 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -71,6 +71,7 @@ jobs: cd "$folder" cd - done + rm folders.json - name: Setup GitHub Token for creating a new PR id: setup-github-token-write From 5af391ebf6d7cd91081bbba56f7055ab80895e80 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 17:36:21 +0100 Subject: [PATCH 20/26] try to find relevant changes --- .github/workflows/generate-go-docs.yaml | 72 ++++++++++++++++++------- 1 file changed, 54 insertions(+), 18 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 2a0e742b8..02b3340b4 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -16,47 +16,83 @@ jobs: contents: read steps: - - name: Setup GitHub Token for reading Generate Go Doc Repo - id: setup-github-token-read - uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 - with: - aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }} - aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} - aws-region: ${{ secrets.AWS_REGION }} + # - name: Setup GitHub Token for reading Generate Go Doc Repo + # id: setup-github-token-read + # uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 + # with: + # aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }} + # aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} + # aws-region: ${{ secrets.AWS_REGION }} - name: Configure git for private repository and install go tools env: GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs run: | - git config --global \ - url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" - go install github.com/smartcontractkit/generate-go-function-docs@latest + # git config --global \ + # url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" + # go install github.com/smartcontractkit/generate-go-function-docs@latest go install github.com/jmank88/gomods@v0.1.3 - go install golang.org/x/tools/gopls@latest + # go install golang.org/x/tools/gopls@latest - name: Checkout current branch uses: actions/checkout@v3 with: fetch-depth: 0 + - name: Detect changes + uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + id: changes + with: + filters: | + seth: + - 'seth/**/*.go' + wasp: + - 'wasp/**/*.go' + havoc: + - 'havoc/**/*.go' + lib: + - 'lib/**/*.go' + k8s-test-runner: + - 'k8s-test-runner/**/*.go' + framework: + - 'framework/**/*.go' + # later add tools here or make this filter dynamic (if possible) + - name: Find all go modules shell: bash id: go-modules + env: + FILTERS: ${{ steps.changes.outputs.changes }} run: | PATH=$PATH:$(go env GOPATH)/bin - export PATH + export PATH + gomods_output=$(gomods 2>&1) # Extract the parent directories of go.mod files parent_folders=$(echo "$gomods_output" | grep 'go\.mod$' | sed 's/\/go\.mod//' | sed 's/^[ \t]*//;s/[ \t]*$//' | xargs -n 1) # Convert parent directories into a JSON matrix - echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > folders.json + echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > all_folders.json + + echo "$FILTERS" > filters.json + + cat filters.json + + jq --argjson filters "$(cat filters.json)" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json + + echo "Full folder List JSON" + cat all_folders.json + + echo "Filtered folder List JSON" + cat filtered_folders.json + + exit 1 - echo "Folder List JSON" - cat folders.json + rm filters.json + rm all_folders.json - - name: Generate go docs for all projects + - name: Generate go docs for changed projects shell: bash env: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} @@ -64,14 +100,14 @@ jobs: # Add go binary to PATH PATH=$PATH:$(go env GOPATH)/bin export PATH - cat folders.json | jq -c '.[]' | while read -r item; do + cat filtered_folders.json | jq -c '.[]' | while read -r item; do folder=$(echo "$item" | jq -r '.folder') echo "Processing folder: $folder" generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f "$folder" cd "$folder" cd - done - rm folders.json + rm filtered_folders.json - name: Setup GitHub Token for creating a new PR id: setup-github-token-write From a44f20b60e25571290549640e6914111c2cfe9b8 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 18:16:02 +0100 Subject: [PATCH 21/26] run doc generation only for modified projects --- .github/workflows/generate-go-docs.yaml | 43 ++++++++++++------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 02b3340b4..96fdc3281 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -16,23 +16,22 @@ jobs: contents: read steps: - # - name: Setup GitHub Token for reading Generate Go Doc Repo - # id: setup-github-token-read - # uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 - # with: - # aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }} - # aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} - # aws-region: ${{ secrets.AWS_REGION }} + - name: Setup GitHub Token for reading Generate Go Doc Repo + id: setup-github-token-read + uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 + with: + aws-role-arn: ${{ secrets.AWS_ROLE_ARN_READ_GENERATE_GO_DOC_REPO }} + aws-lambda-url: ${{ secrets.GATI_LAMBDA_TT_URL }} + aws-region: ${{ secrets.AWS_REGION }} - name: Configure git for private repository and install go tools env: GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs run: | - # git config --global \ - # url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" - # go install github.com/smartcontractkit/generate-go-function-docs@latest + git config --global url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" + go install github.com/smartcontractkit/generate-go-function-docs@latest go install github.com/jmank88/gomods@v0.1.3 - # go install golang.org/x/tools/gopls@latest + go install golang.org/x/tools/gopls@latest - name: Checkout current branch uses: actions/checkout@v3 @@ -67,6 +66,7 @@ jobs: PATH=$PATH:$(go env GOPATH)/bin export PATH + # Find all go projects gomods_output=$(gomods 2>&1) # Extract the parent directories of go.mod files @@ -75,21 +75,12 @@ jobs: # Convert parent directories into a JSON matrix echo "$parent_folders" | jq -R -s 'split("\n") | map(select(length > 0)) | map({folder: .})' > all_folders.json - echo "$FILTERS" > filters.json - - cat filters.json - - jq --argjson filters "$(cat filters.json)" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json - - echo "Full folder List JSON" - cat all_folders.json + # Filter the directories that did not changeß + jq --argjson filters "$FILTERS" 'map(select(.folder as $folder | $filters | index($folder)))' all_folders.json > filtered_folders.json echo "Filtered folder List JSON" cat filtered_folders.json - exit 1 - - rm filters.json rm all_folders.json - name: Generate go docs for changed projects @@ -103,12 +94,18 @@ jobs: cat filtered_folders.json | jq -c '.[]' | while read -r item; do folder=$(echo "$item" | jq -r '.folder') echo "Processing folder: $folder" - generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} -g chatgpt -f "$folder" + generate-go-function-docs diff -b ${{ github.event.pull_request.base.sha }} -c ${{ github.event.pull_request.head.sha }} --saveCosts --generator chatgpt --folder "$folder" cd "$folder" cd - done rm filtered_folders.json + - name: Save costs + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: generation-costs + path: ./costs + - name: Setup GitHub Token for creating a new PR id: setup-github-token-write uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # setup-github-token@0.1.2 From 85a2210be01a8e58e91a9d5e15963c18d4459bde Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Thu, 5 Dec 2024 18:26:35 +0100 Subject: [PATCH 22/26] do not commit costs --- .github/workflows/generate-go-docs.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 96fdc3281..8affc6fdd 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -38,7 +38,7 @@ jobs: with: fetch-depth: 0 - - name: Detect changes + - name: Detect changes related to current PR uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 id: changes with: @@ -57,7 +57,7 @@ jobs: - 'framework/**/*.go' # later add tools here or make this filter dynamic (if possible) - - name: Find all go modules + - name: Find all go modules in the repository and filter the ones that changed shell: bash id: go-modules env: @@ -100,11 +100,15 @@ jobs: done rm filtered_folders.json - - name: Save costs + - name: Upload costs as artifact uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 with: name: generation-costs - path: ./costs + path: ./costs + + - name: Remove costs before committing + shell: bash + run: rm -rf costs - name: Setup GitHub Token for creating a new PR id: setup-github-token-write From 995c1bbc110c2ac10b05d30ea6b2fa2eeabe90b4 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 6 Dec 2024 12:14:27 +0100 Subject: [PATCH 23/26] use tagged go doc tool --- .github/workflows/generate-go-docs.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 8affc6fdd..42ac586a7 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -29,7 +29,7 @@ jobs: GOPRIVATE: github.com/smartcontractkit/generate-go-function-docs run: | git config --global url."https://x-access-token:${{ steps.setup-github-token-read.outputs.access-token }}@github.com/".insteadOf "https://github.com/" - go install github.com/smartcontractkit/generate-go-function-docs@latest + go install github.com/smartcontractkit/generate-go-function-docs@v0.0.1 go install github.com/jmank88/gomods@v0.1.3 go install golang.org/x/tools/gopls@latest @@ -55,7 +55,7 @@ jobs: - 'k8s-test-runner/**/*.go' framework: - 'framework/**/*.go' - # later add tools here or make this filter dynamic (if possible) + # later add tools here or, if possible, make this filter dynamic so that it's created based on the go modules in the repository - name: Find all go modules in the repository and filter the ones that changed shell: bash From d1a61fa33e6e27233a9c9fa8b49fbf89161a8fa9 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Fri, 6 Dec 2024 12:17:51 +0100 Subject: [PATCH 24/26] try with files in 2 projects --- k8s-test-runner/k8s_client/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/k8s-test-runner/k8s_client/client.go b/k8s-test-runner/k8s_client/client.go index c8c6e2ed8..a0b28e369 100644 --- a/k8s-test-runner/k8s_client/client.go +++ b/k8s-test-runner/k8s_client/client.go @@ -85,6 +85,10 @@ func retryK8sCall(operation k8sOperation, retryPolicy wait.Backoff) error { return nil } +func IDoNothing() { + //I really do nothing +} + func (m *Client) ListPods(ctx context.Context, namespace, syncLabel string) (*v1.PodList, error) { var pods *v1.PodList timeout := int64(30) From 2e0332890a4c1a543b272ee4f7adcd468214fc66 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 9 Dec 2024 10:26:05 +0100 Subject: [PATCH 25/26] test doc generation failure notification --- .github/workflows/generate-go-docs.yaml | 60 +- ...c5826a572c09f8b93df3b9f674113372ce925.json | 636 ++++++++++++++++++ 2 files changed, 695 insertions(+), 1 deletion(-) create mode 100644 wasp/performance_reports/TestBenchSpyWithStandardGeneratorMetrics-e7fc5826a572c09f8b93df3b9f674113372ce925.json diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index 42ac586a7..cc989a0fd 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -11,6 +11,7 @@ jobs: generate_docs_new_pr: if: ${{ contains(github.event.pull_request.labels.*.name, 'generate_go_docs') }} runs-on: ubuntu-latest + environment: integration permissions: id-token: write contents: read @@ -108,7 +109,10 @@ jobs: - name: Remove costs before committing shell: bash - run: rm -rf costs + run: | + rm -rf costs + # remove after testing + exit 1 - name: Setup GitHub Token for creating a new PR id: setup-github-token-write @@ -127,3 +131,57 @@ jobs: title: "Go docs for PR#${{ github.event.pull_request.number }}" body: "This PR contains automatically generated go documentation for the PR#${{ github.event.pull_request.number }}. Please review the changes." commit-message: "[Bot] Add automatically generated go documentation" + + - name: Send Slack notification + uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0 + if: failure() || cancelled() + id: slack + env: + SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} + with: + channel-id: 'C049X3353K2' + payload: | + { + "attachments": [ + { + "color": "${{ contains(join(needs.*.result, ','), 'failure') && '#C62828' || contains(join(needs.*.result, ','), 'cancelled') && '#FFA000' || '2E7D32' }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Go doc generation - ${{ contains(join(needs.*.result, ','), 'failure') && 'Failed :x:' || contains(join(needs.*.result, ','), 'cancelled') && 'Cancelled :warning:' }}" + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "${{ github.ref_name }} | <${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}|PR#${{ github.event.pull_request.number }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + } + } + ] + } + ] + } + + - name: Notify user in Slack message if tests failed + if: failure() || cancelled() + uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0 + env: + SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} + with: + channel-id: 'C049X3353K2' + payload: | + { + "thread_ts": "${{ steps.slack.outputs.thread_ts }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "Notifying <@U060CGGPY8H>, please check doc generation log." + } + } + ] + } \ No newline at end of file diff --git a/wasp/performance_reports/TestBenchSpyWithStandardGeneratorMetrics-e7fc5826a572c09f8b93df3b9f674113372ce925.json b/wasp/performance_reports/TestBenchSpyWithStandardGeneratorMetrics-e7fc5826a572c09f8b93df3b9f674113372ce925.json new file mode 100644 index 000000000..5a3f08b16 --- /dev/null +++ b/wasp/performance_reports/TestBenchSpyWithStandardGeneratorMetrics-e7fc5826a572c09f8b93df3b9f674113372ce925.json @@ -0,0 +1,636 @@ +{ + "test_name": "TestBenchSpyWithStandardGeneratorMetrics", + "commit_or_tag": "e7fc5826a572c09f8b93df3b9f674113372ce925", + "test_start_timestamp": "2024-12-06T17:25:58.574504+01:00", + "test_end_timestamp": "2024-12-06T17:26:28.094807+01:00", + "generator_configs": { + "vu": { + "generator_name": "vu", + "load_type": "vu_schedule", + "schedule": [ + { + "from": 10, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:58.574504+01:00", + "time_end": "2024-12-06T17:25:59.575844+01:00" + }, + { + "from": 11, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:59.575848+01:00", + "time_end": "2024-12-06T17:26:00.577246+01:00" + }, + { + "from": 12, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:00.577249+01:00", + "time_end": "2024-12-06T17:26:01.578393+01:00" + }, + { + "from": 13, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:01.578396+01:00", + "time_end": "2024-12-06T17:26:02.579112+01:00" + }, + { + "from": 14, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:02.579114+01:00", + "time_end": "2024-12-06T17:26:03.580339+01:00" + }, + { + "from": 15, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:03.580343+01:00", + "time_end": "2024-12-06T17:26:04.580933+01:00" + }, + { + "from": 16, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:04.580936+01:00", + "time_end": "2024-12-06T17:26:05.581708+01:00" + }, + { + "from": 17, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:05.581712+01:00", + "time_end": "2024-12-06T17:26:06.583153+01:00" + }, + { + "from": 18, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:06.583156+01:00", + "time_end": "2024-12-06T17:26:07.583928+01:00" + }, + { + "from": 19, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:07.58393+01:00", + "time_end": "2024-12-06T17:26:08.58477+01:00" + }, + { + "from": 30, + "duration": 15000000000, + "type": "plain", + "time_start": "2024-12-06T17:26:08.584771+01:00", + "time_end": "2024-12-06T17:26:23.585705+01:00" + }, + { + "from": 20, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:23.585708+01:00", + "time_end": "2024-12-06T17:26:24.086333+01:00" + }, + { + "from": 19, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.086335+01:00", + "time_end": "2024-12-06T17:26:24.58712+01:00" + }, + { + "from": 18, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.587122+01:00", + "time_end": "2024-12-06T17:26:25.088329+01:00" + }, + { + "from": 17, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.088332+01:00", + "time_end": "2024-12-06T17:26:25.589171+01:00" + }, + { + "from": 16, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.589173+01:00", + "time_end": "2024-12-06T17:26:26.089775+01:00" + }, + { + "from": 15, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.089777+01:00", + "time_end": "2024-12-06T17:26:26.591099+01:00" + }, + { + "from": 14, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.5911+01:00", + "time_end": "2024-12-06T17:26:27.092352+01:00" + }, + { + "from": 13, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.092355+01:00", + "time_end": "2024-12-06T17:26:27.593582+01:00" + }, + { + "from": 12, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.593585+01:00", + "time_end": "2024-12-06T17:26:28.094807+01:00" + }, + { + "from": 11, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:28.09481+01:00", + "time_end": "2024-12-06T17:25:58.574501+01:00" + }, + { + "from": 10, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:58.574504+01:00", + "time_end": "2024-12-06T17:25:59.575844+01:00" + }, + { + "from": 11, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:59.575848+01:00", + "time_end": "2024-12-06T17:26:00.577246+01:00" + }, + { + "from": 12, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:00.577249+01:00", + "time_end": "2024-12-06T17:26:01.578393+01:00" + }, + { + "from": 13, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:01.578396+01:00", + "time_end": "2024-12-06T17:26:02.579112+01:00" + }, + { + "from": 14, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:02.579114+01:00", + "time_end": "2024-12-06T17:26:03.580339+01:00" + }, + { + "from": 15, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:03.580343+01:00", + "time_end": "2024-12-06T17:26:04.580933+01:00" + }, + { + "from": 16, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:04.580936+01:00", + "time_end": "2024-12-06T17:26:05.581708+01:00" + }, + { + "from": 17, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:05.581712+01:00", + "time_end": "2024-12-06T17:26:06.583153+01:00" + }, + { + "from": 18, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:06.583156+01:00", + "time_end": "2024-12-06T17:26:07.583928+01:00" + }, + { + "from": 19, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:07.58393+01:00", + "time_end": "2024-12-06T17:26:08.58477+01:00" + }, + { + "from": 30, + "duration": 15000000000, + "type": "plain", + "time_start": "2024-12-06T17:26:08.584771+01:00", + "time_end": "2024-12-06T17:26:23.585705+01:00" + }, + { + "from": 20, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:23.585708+01:00", + "time_end": "2024-12-06T17:26:24.086333+01:00" + }, + { + "from": 19, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.086335+01:00", + "time_end": "2024-12-06T17:26:24.58712+01:00" + }, + { + "from": 18, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.587122+01:00", + "time_end": "2024-12-06T17:26:25.088329+01:00" + }, + { + "from": 17, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.088332+01:00", + "time_end": "2024-12-06T17:26:25.589171+01:00" + }, + { + "from": 16, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.589173+01:00", + "time_end": "2024-12-06T17:26:26.089775+01:00" + }, + { + "from": 15, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.089777+01:00", + "time_end": "2024-12-06T17:26:26.591099+01:00" + }, + { + "from": 14, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.5911+01:00", + "time_end": "2024-12-06T17:26:27.092352+01:00" + }, + { + "from": 13, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.092355+01:00", + "time_end": "2024-12-06T17:26:27.593582+01:00" + }, + { + "from": 12, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.593585+01:00", + "time_end": "2024-12-06T17:26:28.094807+01:00" + }, + { + "from": 11, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:28.09481+01:00", + "time_end": "2024-12-06T17:25:58.574501+01:00" + } + ], + "rate_limit_unit_duration": 1000000000, + "call_timeout": 100000000 + } + }, + "directory": "performance_reports", + "execution_environment": "docker", + "resource_selection_pattern": "", + "query_executors": [ + { + "kind": "generator", + "generator_config": { + "generator_name": "vu", + "load_type": "vu_schedule", + "schedule": [ + { + "from": 10, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:58.574504+01:00", + "time_end": "2024-12-06T17:25:59.575844+01:00" + }, + { + "from": 11, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:59.575848+01:00", + "time_end": "2024-12-06T17:26:00.577246+01:00" + }, + { + "from": 12, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:00.577249+01:00", + "time_end": "2024-12-06T17:26:01.578393+01:00" + }, + { + "from": 13, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:01.578396+01:00", + "time_end": "2024-12-06T17:26:02.579112+01:00" + }, + { + "from": 14, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:02.579114+01:00", + "time_end": "2024-12-06T17:26:03.580339+01:00" + }, + { + "from": 15, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:03.580343+01:00", + "time_end": "2024-12-06T17:26:04.580933+01:00" + }, + { + "from": 16, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:04.580936+01:00", + "time_end": "2024-12-06T17:26:05.581708+01:00" + }, + { + "from": 17, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:05.581712+01:00", + "time_end": "2024-12-06T17:26:06.583153+01:00" + }, + { + "from": 18, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:06.583156+01:00", + "time_end": "2024-12-06T17:26:07.583928+01:00" + }, + { + "from": 19, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:07.58393+01:00", + "time_end": "2024-12-06T17:26:08.58477+01:00" + }, + { + "from": 30, + "duration": 15000000000, + "type": "plain", + "time_start": "2024-12-06T17:26:08.584771+01:00", + "time_end": "2024-12-06T17:26:23.585705+01:00" + }, + { + "from": 20, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:23.585708+01:00", + "time_end": "2024-12-06T17:26:24.086333+01:00" + }, + { + "from": 19, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.086335+01:00", + "time_end": "2024-12-06T17:26:24.58712+01:00" + }, + { + "from": 18, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.587122+01:00", + "time_end": "2024-12-06T17:26:25.088329+01:00" + }, + { + "from": 17, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.088332+01:00", + "time_end": "2024-12-06T17:26:25.589171+01:00" + }, + { + "from": 16, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.589173+01:00", + "time_end": "2024-12-06T17:26:26.089775+01:00" + }, + { + "from": 15, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.089777+01:00", + "time_end": "2024-12-06T17:26:26.591099+01:00" + }, + { + "from": 14, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.5911+01:00", + "time_end": "2024-12-06T17:26:27.092352+01:00" + }, + { + "from": 13, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.092355+01:00", + "time_end": "2024-12-06T17:26:27.593582+01:00" + }, + { + "from": 12, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.593585+01:00", + "time_end": "2024-12-06T17:26:28.094807+01:00" + }, + { + "from": 11, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:28.09481+01:00", + "time_end": "2024-12-06T17:25:58.574501+01:00" + }, + { + "from": 10, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:58.574504+01:00", + "time_end": "2024-12-06T17:25:59.575844+01:00" + }, + { + "from": 11, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:25:59.575848+01:00", + "time_end": "2024-12-06T17:26:00.577246+01:00" + }, + { + "from": 12, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:00.577249+01:00", + "time_end": "2024-12-06T17:26:01.578393+01:00" + }, + { + "from": 13, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:01.578396+01:00", + "time_end": "2024-12-06T17:26:02.579112+01:00" + }, + { + "from": 14, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:02.579114+01:00", + "time_end": "2024-12-06T17:26:03.580339+01:00" + }, + { + "from": 15, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:03.580343+01:00", + "time_end": "2024-12-06T17:26:04.580933+01:00" + }, + { + "from": 16, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:04.580936+01:00", + "time_end": "2024-12-06T17:26:05.581708+01:00" + }, + { + "from": 17, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:05.581712+01:00", + "time_end": "2024-12-06T17:26:06.583153+01:00" + }, + { + "from": 18, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:06.583156+01:00", + "time_end": "2024-12-06T17:26:07.583928+01:00" + }, + { + "from": 19, + "duration": 1000000000, + "type": "steps", + "time_start": "2024-12-06T17:26:07.58393+01:00", + "time_end": "2024-12-06T17:26:08.58477+01:00" + }, + { + "from": 30, + "duration": 15000000000, + "type": "plain", + "time_start": "2024-12-06T17:26:08.584771+01:00", + "time_end": "2024-12-06T17:26:23.585705+01:00" + }, + { + "from": 20, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:23.585708+01:00", + "time_end": "2024-12-06T17:26:24.086333+01:00" + }, + { + "from": 19, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.086335+01:00", + "time_end": "2024-12-06T17:26:24.58712+01:00" + }, + { + "from": 18, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:24.587122+01:00", + "time_end": "2024-12-06T17:26:25.088329+01:00" + }, + { + "from": 17, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.088332+01:00", + "time_end": "2024-12-06T17:26:25.589171+01:00" + }, + { + "from": 16, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:25.589173+01:00", + "time_end": "2024-12-06T17:26:26.089775+01:00" + }, + { + "from": 15, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.089777+01:00", + "time_end": "2024-12-06T17:26:26.591099+01:00" + }, + { + "from": 14, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:26.5911+01:00", + "time_end": "2024-12-06T17:26:27.092352+01:00" + }, + { + "from": 13, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.092355+01:00", + "time_end": "2024-12-06T17:26:27.593582+01:00" + }, + { + "from": 12, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:27.593585+01:00", + "time_end": "2024-12-06T17:26:28.094807+01:00" + }, + { + "from": 11, + "duration": 500000000, + "type": "steps", + "time_start": "2024-12-06T17:26:28.09481+01:00", + "time_end": "2024-12-06T17:25:58.574501+01:00" + } + ], + "rate_limit_unit_duration": 1000000000, + "call_timeout": 100000000 + }, + "queries": [ + "median_latency", + "95th_percentile_latency", + "error_rate" + ], + "query_results": { + "95th_percentile_latency": [ + "51.0000" + ], + "error_rate": [ + "0.0000" + ], + "median_latency": [ + "50.0000" + ] + } + } + ] +} \ No newline at end of file From 02c7efc86f935a1efe6ec28a595d96fb20831604 Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Mon, 9 Dec 2024 10:31:25 +0100 Subject: [PATCH 26/26] tweak notification --- .github/workflows/generate-go-docs.yaml | 45 +++++++++---------------- 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/.github/workflows/generate-go-docs.yaml b/.github/workflows/generate-go-docs.yaml index cc989a0fd..2729e6c3f 100644 --- a/.github/workflows/generate-go-docs.yaml +++ b/.github/workflows/generate-go-docs.yaml @@ -64,6 +64,8 @@ jobs: env: FILTERS: ${{ steps.changes.outputs.changes }} run: | + # remove after test + exit 1 PATH=$PATH:$(go env GOPATH)/bin export PATH @@ -109,10 +111,7 @@ jobs: - name: Remove costs before committing shell: bash - run: | - rm -rf costs - # remove after testing - exit 1 + run: rm -rf costs - name: Setup GitHub Token for creating a new PR id: setup-github-token-write @@ -134,7 +133,7 @@ jobs: - name: Send Slack notification uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0 - if: failure() || cancelled() + if: failure() id: slack env: SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} @@ -144,44 +143,30 @@ jobs: { "attachments": [ { - "color": "${{ contains(join(needs.*.result, ','), 'failure') && '#C62828' || contains(join(needs.*.result, ','), 'cancelled') && '#FFA000' || '2E7D32' }}", + "color": "#C62828", "blocks": [ { "type": "section", "text": { "type": "mrkdwn", - "text": "Go doc generation - ${{ contains(join(needs.*.result, ','), 'failure') && 'Failed :x:' || contains(join(needs.*.result, ','), 'cancelled') && 'Cancelled :warning:' }}" + "text": "Go doc generation - Failed :x:" } }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "<@U060CGGPY8H>, please have a look." + } + }, { "type": "section", "text": { "type": "mrkdwn", - "text": "${{ github.ref_name }} | <${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}|PR#${{ github.event.pull_request.number }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Details>" + "text": "<${{ github.server_url }}/${{ github.repository }}/pull/${{ github.event.pull_request.number }}|PR#${{ github.event.pull_request.number }}> | <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run Details>" } } ] } ] - } - - - name: Notify user in Slack message if tests failed - if: failure() || cancelled() - uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0 - env: - SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }} - with: - channel-id: 'C049X3353K2' - payload: | - { - "thread_ts": "${{ steps.slack.outputs.thread_ts }}", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "Notifying <@U060CGGPY8H>, please check doc generation log." - } - } - ] - } \ No newline at end of file + } \ No newline at end of file