workflow: fix size report base branch

This commit is contained in:
Evan You 2024-08-08 18:06:32 +08:00
parent 236fb7abeb
commit 32a1433e0d
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
2 changed files with 19 additions and 9 deletions

View File

@ -43,12 +43,16 @@ jobs:
name: size-data name: size-data
path: temp/size path: temp/size
- name: Save PR number - name: Save PR number & base branch
if: ${{github.event_name == 'pull_request'}} 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 - uses: actions/upload-artifact@v4
if: ${{github.event_name == 'pull_request'}} if: ${{github.event_name == 'pull_request'}}
with: with:
name: pr-number name: pr-info
path: pr.txt path: |
number.txt
base.txt

View File

@ -35,18 +35,24 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install
- name: Download PR number - name: Download PR info
uses: dawidd6/action-download-artifact@v6 uses: dawidd6/action-download-artifact@v6
with: with:
name: pr-number name: pr-info
run_id: ${{ github.event.workflow_run.id }} run_id: ${{ github.event.workflow_run.id }}
path: /tmp/pr-number path: /tmp/pr-info
- name: Read PR Number - name: Read PR Number
id: pr-number id: pr-number
uses: juliangruber/read-file-action@v1 uses: juliangruber/read-file-action@v1
with: 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 - name: Download Size Data
uses: dawidd6/action-download-artifact@v6 uses: dawidd6/action-download-artifact@v6
@ -58,7 +64,7 @@ jobs:
- name: Download Previous Size Data - name: Download Previous Size Data
uses: dawidd6/action-download-artifact@v6 uses: dawidd6/action-download-artifact@v6
with: with:
branch: ${{ github.base_ref }} branch: ${{ steps.pr-base.outputs.content }}
workflow: size-data.yml workflow: size-data.yml
event: push event: push
name: size-data name: size-data