From 70e7329ac5dbc99c79053fc880c831c71f8e336b Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 9 Aug 2024 00:58:50 +0800 Subject: [PATCH] workflow: simplify size report --- .github/workflows/size-data.yml | 18 -------------- .github/workflows/size-report.yml | 41 ++++++------------------------- 2 files changed, 7 insertions(+), 52 deletions(-) diff --git a/.github/workflows/size-data.yml b/.github/workflows/size-data.yml index f73a59607af..ac61a4bd178 100644 --- a/.github/workflows/size-data.yml +++ b/.github/workflows/size-data.yml @@ -5,10 +5,6 @@ on: branches: - main - minor - pull_request: - branches: - - main - - minor permissions: contents: read @@ -42,17 +38,3 @@ jobs: with: name: size-data path: temp/size - - - name: Save PR number & base branch - if: ${{github.event_name == 'pull_request'}} - run: | - echo ${{ github.event.number }} > ./number.txt - echo ${{ github.base_ref }} > ./base.txt - - - uses: actions/upload-artifact@v4 - if: ${{github.event_name == 'pull_request'}} - with: - name: pr-info - path: | - number.txt - base.txt diff --git a/.github/workflows/size-report.yml b/.github/workflows/size-report.yml index c8258f8b920..58737349679 100644 --- a/.github/workflows/size-report.yml +++ b/.github/workflows/size-report.yml @@ -1,10 +1,10 @@ name: size report on: - workflow_run: - workflows: ['size data'] - types: - - completed + pull_request: + branches: + - main + - minor permissions: contents: read @@ -17,9 +17,6 @@ env: jobs: size-report: runs-on: ubuntu-latest - if: > - github.event.workflow_run.event == 'pull_request' && - github.event.workflow_run.conclusion == 'success' steps: - uses: actions/checkout@v4 @@ -35,36 +32,12 @@ jobs: - name: Install dependencies run: pnpm install - - name: Download PR info - uses: dawidd6/action-download-artifact@v6 - with: - name: pr-info - run_id: ${{ github.event.workflow_run.id }} - path: /tmp/pr-info - - - name: Read PR Number - id: pr-number - uses: juliangruber/read-file-action@v1 - with: - path: /tmp/pr-info/number.txt - - - name: Read PR base branch - id: pr-base - uses: juliangruber/read-file-action@v1 - with: - path: /tmp/pr-info/base.txt - - - name: Download Size Data - uses: dawidd6/action-download-artifact@v6 - with: - name: size-data - run_id: ${{ github.event.workflow_run.id }} - path: temp/size + - run: pnpm run size - name: Download Previous Size Data uses: dawidd6/action-download-artifact@v6 with: - branch: ${{ steps.pr-base.outputs.content }} + branch: ${{ github.base_ref }} workflow: size-data.yml event: push name: size-data @@ -84,7 +57,7 @@ jobs: uses: actions-cool/maintain-one-comment@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - number: ${{ steps.pr-number.outputs.content }} + number: ${{ github.event.number }} body: | ${{ steps.size-report.outputs.content }}