Skip to content

Commit

Permalink
workflow: simplify size report
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 8, 2024
1 parent 23e0988 commit 70e7329
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 52 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/size-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ on:
branches:
- main
- minor
pull_request:
branches:
- main
- minor

permissions:
contents: read
Expand Down Expand Up @@ -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
41 changes: 7 additions & 34 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: size report

on:
workflow_run:
workflows: ['size data']
types:
- completed
pull_request:
branches:
- main
- minor

permissions:
contents: read
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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 }}
<!-- VUE_CORE_SIZE -->
Expand Down

0 comments on commit 70e7329

Please sign in to comment.