Skip to content

Commit 478c742

Browse files
committed
fix: update workflow
1 parent c31cd59 commit 478c742

4 files changed

Lines changed: 35 additions & 8 deletions

File tree

.github/workflows/analyze.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,26 @@ jobs:
5757
name: bundle_analysis.json
5858

5959
- name: Download base branch bundle stats
60-
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
60+
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
6161
if: success() && github.event.number
6262
with:
6363
workflow: analyze.yml
6464
branch: ${{ github.event.pull_request.base.ref }}
6565
name: bundle_analysis.json
6666
path: .next/analyze/base/bundle
67+
check_artifacts: true
68+
if_no_artifact_found: warn
69+
70+
- name: Check base bundle exists
71+
id: base-bundle
72+
if: success() && github.event.number
73+
run: |
74+
if [ -f .next/analyze/base/bundle/__bundle_analysis.json ]; then
75+
echo "exists=true" >> "$GITHUB_OUTPUT"
76+
else
77+
echo "exists=false" >> "$GITHUB_OUTPUT"
78+
echo "No usable base branch bundle stats found (artifact missing or expired); skipping comparison."
79+
fi
6780
6881
# And here's the second place - this runs after we have both the current and
6982
# base branch bundle stats, and will compare them to determine what changed.
@@ -79,10 +92,11 @@ jobs:
7992
# Either of these arguments can be changed or removed by editing the `nextBundleAnalysis`
8093
# entry in your package.json file.
8194
- name: Compare with base branch bundle
82-
if: success() && github.event.number
95+
if: success() && github.event.number && steps.base-bundle.outputs.exists == 'true'
8396
run: ls -laR .next/analyze/base && npx -p nextjs-bundle-analysis compare
8497

8598
- name: Upload analysis comment
99+
if: success() && steps.base-bundle.outputs.exists == 'true'
86100
uses: actions/upload-artifact@v4
87101
with:
88102
name: analysis_comment.txt

.github/workflows/analyze_comment.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,36 @@ jobs:
1919
github.event.workflow_run.conclusion == 'success' }}
2020
steps:
2121
- name: Download base branch bundle stats
22-
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
22+
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
2323
with:
2424
workflow: analyze.yml
2525
run_id: ${{ github.event.workflow_run.id }}
2626
name: analysis_comment.txt
2727
path: analysis_comment.txt
28+
if_no_artifact_found: warn
2829

2930
- name: Download PR number
30-
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e
31+
uses: dawidd6/action-download-artifact@ac66b43f0e6a346234dd65d4d0c8fbb31cb316e5 # v11
3132
with:
3233
workflow: analyze.yml
3334
run_id: ${{ github.event.workflow_run.id }}
3435
name: pr_number
3536
path: pr_number
37+
if_no_artifact_found: warn
38+
39+
- name: Check comment artifact exists
40+
id: comment-artifact
41+
run: |
42+
if [ -f analysis_comment.txt/__bundle_analysis_comment.txt ] && [ -f pr_number/pr_number ]; then
43+
echo "exists=true" >> "$GITHUB_OUTPUT"
44+
else
45+
echo "exists=false" >> "$GITHUB_OUTPUT"
46+
echo "No bundle analysis comment artifact (comparison was skipped); nothing to post."
47+
fi
3648
3749
- name: Get comment body
3850
id: get-comment-body
39-
if: success()
51+
if: success() && steps.comment-artifact.outputs.exists == 'true'
4052
run: |
4153
echo 'body<<EOF' >> $GITHUB_OUTPUT
4254
echo '' >> $GITHUB_OUTPUT
@@ -53,6 +65,7 @@ jobs:
5365
echo "pr-number=$pr_number" >> $GITHUB_OUTPUT
5466
5567
- name: Comment
68+
if: success() && steps.comment-artifact.outputs.exists == 'true'
5669
uses: marocchino/sticky-pull-request-comment@52423e01640425a022ef5fd42c6fb5f633a02728
5770
with:
5871
header: next-bundle-analysis

src/content/learn/add-react-to-an-existing-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ Wenn du zusätzliche Interaktivität zu deinem bestehenden Projekt hinzufügen m
1616

1717
## React für eine ganze Subroute einer bestehenden Webseite verwenden {/*using-react-for-an-entire-subroute-of-your-existing-website*/}
1818

19-
Lass uns annehmen, du hast eine bestehende Webseite auf `example.com`, die mit einer anderen Server-Technologie (z.B. Rails) erstellt wurde und du willst nun alle
19+
Lass uns annehmen, du hast eine bestehende Webseite auf `example.com`, die mit einer anderen Server-Technologie (z.B. Rails) erstellt wurde und du willst nun alle
2020
Routen, die mit `example.com/deine-app/` beginnen, vollständig mit React implementieren.
2121

2222
In diesem Fall empfehlen wir dir folgende Schritte:
2323

24-
1. **Erstelle den Teil der App, die mit React umgesetzt werden soll**, indem du eines der [auf React basierenden Frameworks](/learn/creating-a-react-ap) verwendest.
24+
1. **Erstelle den Teil der App, die mit React umgesetzt werden soll**, indem du eines der [auf React basierenden Frameworks](/learn/creating-a-react-app) verwendest.
2525
2. **Definiere `/deine-app` als *base path*** in der Konfiguration deines Frameworks ( [Next.js](https://nextjs.org/docs/app/api-reference/config/next-config-js/basePath), [Gatsby](https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/)).
2626
3. **Konfiguriere deinen Server oder Proxy** so, dass alle Anfragen an `/deine-app/` von der React-Anwendung verarbeitet werden.
2727

src/content/learn/thinking-in-react.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Füge der Komponente mit dem [`useState()` Hook](/reference/react/useState) Hook
279279
function FilterableProductTable({ products }) {
280280
const [filterText, setFilterText] = useState('');
281281
const [inStockOnly, setInStockOnly] = useState(false);
282-
}
282+
}
283283
```
284284

285285
Dann übergibst du `filterText` und `inStockOnly` an `ProductTable` und `SearchBar` als Props:

0 commit comments

Comments
 (0)