Skip to content

Commit 81487f7

Browse files
chore: try to sync workflows as the upstream may fix the ci
1 parent a468e85 commit 81487f7

File tree

2 files changed

+7
-41
lines changed

2 files changed

+7
-41
lines changed

.github/workflows/analyze.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,9 @@ on:
77
- main # change this if your default branch is named differently
88
workflow_dispatch:
99

10-
permissions: {}
10+
permissions: {}
1111

1212
jobs:
13-
event_type:
14-
runs-on: ubuntu-latest
15-
steps:
16-
- uses: actions/checkout@v3
17-
18-
- name: Save Event Type
19-
run: echo ${{ github.event_name }} > ./event_type
20-
21-
- name: Upload Event Type
22-
uses: actions/upload-artifact@v4
23-
with:
24-
path: ./event_type
25-
name: event_type
26-
2713
analyze:
2814
runs-on: ubuntu-latest
2915
steps:
@@ -75,7 +61,7 @@ jobs:
7561
if: success() && github.event.number
7662
with:
7763
workflow: analyze.yml
78-
branch: ${{ github.event.pull_request.base.ref || 'main' }}
64+
branch: ${{ github.event.pull_request.base.ref }}
7965
name: bundle_analysis.json
8066
path: .next/analyze/base/bundle
8167

@@ -93,7 +79,7 @@ jobs:
9379
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
9480
# entry in your package.json file.
9581
- name: Compare with base branch bundle
96-
if: success()
82+
if: success() && github.event.number
9783
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
9884

9985
- name: Upload analysis comment
@@ -102,13 +88,6 @@ jobs:
10288
name: analysis_comment.txt
10389
path: .next/analyze/__bundle_analysis_comment.txt
10490

105-
number:
106-
runs-on: ubuntu-latest
107-
needs: analyze
108-
if: github.event_name == 'pull_request'
109-
steps:
110-
- uses: actions/checkout@v3
111-
11291
- name: Save PR number
11392
run: echo ${{ github.event.number }} > ./pr_number
11493

.github/workflows/analyze_comment.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@ permissions:
1414
jobs:
1515
comment:
1616
runs-on: ubuntu-latest
17+
if: >
18+
${{ github.event.workflow_run.event == 'pull_request' &&
19+
github.event.workflow_run.conclusion == 'success' }}
1720
steps:
18-
- name: Download Event Type
19-
uses: dawidd6/action-download-artifact@v3
20-
with:
21-
workflow: analyze.yml
22-
run_id: ${{ github.event.workflow_run.id }}
23-
name: event_type
24-
path: event_type
25-
26-
- name: get type
27-
id: get-type
28-
run: |
29-
event_type=$(cat event_type/event_type)
30-
echo "event-type=$event_type" >> $GITHUB_OUTPUT
31-
3221
- name: Download base branch bundle stats
33-
if: github.event.workflow_run.conclusion == 'success' && steps.get-type.outputs.event-type == 'pull_request'
3422
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
3523
with:
3624
workflow: analyze.yml
@@ -39,7 +27,6 @@ jobs:
3927
path: analysis_comment.txt
4028

4129
- name: Download PR number
42-
if: github.event.workflow_run.conclusion == 'success' && steps.get-type.outputs.event-type == 'pull_request'
4330
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
4431
with:
4532
workflow: analyze.yml
@@ -49,7 +36,7 @@ jobs:
4936

5037
- name: Get comment body
5138
id: get-comment-body
52-
if: success() && github.event.workflow_run.conclusion == 'success' && steps.get-type.outputs.event-type == 'pull_request'
39+
if: success()
5340
run: |
5441
echo 'body<<EOF' >> $GITHUB_OUTPUT
5542
echo '' >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)