Skip to content

Commit

Permalink
workflow: fix size report base branch
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Aug 8, 2024
1 parent 236fb7a commit 32a1433
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/size-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ jobs:
name: size-data
path: temp/size

- name: Save PR number
- name: Save PR number & base branch
if: ${{github.event_name == 'pull_request'}}
run: echo ${{ github.event.number }} > ./pr.txt
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-number
path: pr.txt
name: pr-info
path: |
number.txt
base.txt
16 changes: 11 additions & 5 deletions .github/workflows/size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@ jobs:
- name: Install dependencies
run: pnpm install

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

- name: Read PR Number
id: pr-number
uses: juliangruber/read-file-action@v1
with:
path: /tmp/pr-number/pr.txt
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
Expand All @@ -58,7 +64,7 @@ jobs:
- name: Download Previous Size Data
uses: dawidd6/action-download-artifact@v6
with:
branch: ${{ github.base_ref }}
branch: ${{ steps.pr-base.outputs.content }}
workflow: size-data.yml
event: push
name: size-data
Expand Down

0 comments on commit 32a1433

Please sign in to comment.