Skip to content

Commit 3454842

Browse files
committed
fix: add github action workflows
1 parent beb0105 commit 3454842

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

.github/workflows/size-data.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: size data
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
upload:
16+
if: github.repository == 'intlify/vue-i18n'
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout codes
21+
uses: actions/checkout@v4
22+
23+
- name: Install pnpm
24+
uses: pnpm/[email protected]
25+
26+
- name: Setup node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 23
30+
cache: pnpm
31+
32+
- name: Install dependencies
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: Check size
36+
run: pnpm size
37+
38+
- name: Save PR number & base branch
39+
if: ${{github.event_name == 'pull_request'}}
40+
run: |
41+
echo ${{ github.event.number }} > ./temp/size/number.txt
42+
echo ${{ github.base_ref }} > ./temp/size/base.txt
43+
44+
- name: Upload Size Data
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: size-data
48+
path: temp/size

.github/workflows/size-report.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: size report
2+
3+
on:
4+
workflow_run:
5+
workflows: ['size data']
6+
types:
7+
- completed
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
issues: write
13+
14+
jobs:
15+
size-report:
16+
runs-on: ubuntu-latest
17+
if: >
18+
github.repository == 'intlify/vue-i18n' &&
19+
github.event.workflow_run.event == 'pull_request' &&
20+
github.event.workflow_run.conclusion == 'success'
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Install pnpm
25+
uses: pnpm/[email protected]
26+
27+
- name: Install Node.js
28+
uses: actions/setup-node@v4
29+
with:
30+
node-version: 23
31+
cache: pnpm
32+
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
- name: Download Size Data
37+
uses: dawidd6/action-download-artifact@v6
38+
with:
39+
name: size-data
40+
run_id: ${{ github.event.workflow_run.id }}
41+
path: temp/size
42+
43+
- name: Read PR Number
44+
id: pr-number
45+
uses: juliangruber/read-file-action@v1
46+
with:
47+
path: temp/size/number.txt
48+
49+
- name: Read base branch
50+
id: pr-base
51+
uses: juliangruber/read-file-action@v1
52+
with:
53+
path: temp/size/base.txt
54+
55+
- name: Download Previous Size Data
56+
uses: dawidd6/action-download-artifact@v6
57+
with:
58+
branch: ${{ steps.pr-base.outputs.content }}
59+
workflow: size-data.yml
60+
event: push
61+
name: size-data
62+
path: temp/size-prev
63+
if_no_artifact_found: warn
64+
65+
- name: Prepare report
66+
run: npx tsx scripts/size-report.ts > size-report.md
67+
68+
- name: Read Size Report
69+
id: size-report
70+
uses: juliangruber/read-file-action@v1
71+
with:
72+
path: ./size-report.md
73+
74+
- name: Create Comment
75+
uses: actions-cool/maintain-one-comment@v3
76+
with:
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
number: ${{ steps.pr-number.outputs.content }}
79+
body: |
80+
${{ steps.size-report.outputs.content }}
81+
<!-- INTLIFY_VUE_I18N_SIZE -->
82+
body-include: '<!-- INTLIFY_VUE_I18N_SIZE -->'

0 commit comments

Comments
 (0)