workflow: simplify size report action

This commit is contained in:
Evan You 2024-08-09 21:08:27 +08:00
parent 23e098807b
commit cffe8667ee
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
2 changed files with 16 additions and 35 deletions

View File

@ -37,22 +37,14 @@ jobs:
- run: pnpm run size
- name: Save PR number & base branch
if: ${{github.event_name == 'pull_request'}}
run: |
echo ${{ github.event.number }} > ./temp/size/number.txt
echo ${{ github.base_ref }} > ./temp/size/base.txt
- name: Upload Size Data
uses: actions/upload-artifact@v4
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

View File

@ -35,25 +35,6 @@ 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:
@ -61,10 +42,18 @@ jobs:
run_id: ${{ github.event.workflow_run.id }}
path: temp/size
- name: Read PR Number
id: pr-number
run: echo "number=(cat ./temp/size/number.txt)" >> $GITHUB_OUTPUT
- name: Read base branch
id: pr-base
run: echo "base=(cat ./temp/size/base.txt)" >> $GITHUB_OUTPUT
- name: Download Previous Size Data
uses: dawidd6/action-download-artifact@v6
with:
branch: ${{ steps.pr-base.outputs.content }}
branch: ${{ steps.pr-base.outputs.base }}
workflow: size-data.yml
event: push
name: size-data
@ -84,7 +73,7 @@ jobs:
uses: actions-cool/maintain-one-comment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
number: ${{ steps.pr-number.outputs.content }}
number: ${{ steps.pr-number.outputs.number }}
body: |
${{ steps.size-report.outputs.content }}
<!-- VUE_CORE_SIZE -->