From 43fcce3344dcab11fe8440cd0b7b4932f44c3c54 Mon Sep 17 00:00:00 2001 From: Uiolee <22849383+uiolee@users.noreply.github.com> Date: Tue, 16 Apr 2024 23:59:32 +0800 Subject: [PATCH] ci: suppress comment err and reduce benchmark running (#5454) --- .github/workflows/benchmark.yml | 11 ++++++++--- .github/workflows/commenter.yml | 10 +++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e13c8847b1..dc31be7d15 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -1,14 +1,19 @@ name: Benchmark on: + workflow_dispatch: push: + branches: + - "master" paths: - "lib/**" + - ".github/workflows/benchmark.yml" pull_request: branches: - - master - paths-ignore: - - "test/scripts/**" + - "master" + paths: + - "lib/**" + - ".github/workflows/benchmark.yml" jobs: benchmark: diff --git a/.github/workflows/commenter.yml b/.github/workflows/commenter.yml index 1568d8d79e..f8dbf8aaad 100644 --- a/.github/workflows/commenter.yml +++ b/.github/workflows/commenter.yml @@ -13,10 +13,11 @@ permissions: jobs: comment-test: + name: How to test permissions: pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment runs-on: ubuntu-latest - if: ${{github.event_name == 'pull_request_target' }} + if: ${{github.event_name == 'pull_request_target' && github.event.workflow_run.conclusion=='success'}} steps: - name: Comment PR - How to test uses: marocchino/sticky-pull-request-comment@v2 @@ -33,6 +34,7 @@ jobs: ``` comment-flamegraph: + name: Flamegraph permissions: pull-requests: write # for marocchino/sticky-pull-request-comment to create or update PR comment actions: read # get artifact @@ -54,15 +56,17 @@ jobs: echo "pr_number=$(cat .tmp-comment-pr_number)" >> "$GITHUB_ENV" - name: combime comment + if: ${{env.pr_number!=''}} run: | - echo "## flamegraph" > ${{env.comment_result}} + echo "## Flamegraph" > ${{env.comment_result}} echo "" >> ${{env.comment_result}} cat .tmp-comment-flamegraph-*.md >> ${{env.comment_result}} - name: Comment PR - flamegraph + if: ${{env.pr_number!=''}} uses: marocchino/sticky-pull-request-comment@v2 with: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} number: ${{env.pr_number}} - header: flamegraph + header: Flamegraph path: ${{env.comment_result}}