Skip to content

Commit

Permalink
workflow: simplify size report action
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 9, 2024
1 parent 23e0988 commit cffe866
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 33 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/size-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,14 @@ jobs:

- run: pnpm run size

- 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
echo ${{ github.event.number }} > ./temp/size/number.txt
echo ${{ github.base_ref }} > ./temp/size/base.txt
- uses: actions/upload-artifact@v4
if: ${{github.event_name == 'pull_request'}}
- name: Upload Size Data
uses: actions/upload-artifact@v4
with:
name: pr-info
path: |
number.txt
base.txt
name: size-data
path: temp/size
27 changes: 8 additions & 19 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,36 +35,25 @@ jobs:
- name: Install dependencies
run: pnpm install

- name: Download PR info
- name: Download Size Data
uses: dawidd6/action-download-artifact@v6
with:
name: pr-info
name: size-data
run_id: ${{ github.event.workflow_run.id }}
path: /tmp/pr-info
path: temp/size

- name: Read PR Number
id: pr-number
uses: juliangruber/read-file-action@v1
with:
path: /tmp/pr-info/number.txt
run: echo "number=(cat ./temp/size/number.txt)" >> $GITHUB_OUTPUT

- name: Read PR base branch
- name: Read 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: 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
Expand All @@ -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 -->
Expand Down

0 comments on commit cffe866

Please sign in to comment.