Skip to content

Commit 90c9519

Browse files
committed
chore(ci): add new workflows
1 parent 3453255 commit 90c9519

4 files changed

Lines changed: 170 additions & 1 deletion

File tree

.github/labeler.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
test:
2+
- changed-files:
3+
- any-glob-to-any-file: 'tests/**'
4+
5+
ci:
6+
- changed-files:
7+
- any-glob-to-any-file: '.github/workflows/**'
8+
9+
utils:
10+
- changed-files:
11+
- any-glob-to-any-file: 'src/utils/**'
12+
13+
core:
14+
- changed-files:
15+
- any-glob-to-any-file: 'src/core/**'
16+
17+
middleware:
18+
- changed-files:
19+
- any-glob-to-any-file: 'src/middleware/**'
20+
21+
cache:
22+
- changed-files:
23+
- any-glob-to-any-file: 'src/cache/**'
24+
25+
config:
26+
- changed-files:
27+
- any-glob-to-any-file: '*.config.js'
28+
- any-glob-to-any-file: '*.config.mjs'
29+
- any-glob-to-any-file: '*.config.ts'
30+
- any-glob-to-any-file: 'config/**'
31+
32+
types:
33+
- changed-files:
34+
- any-glob-to-any-file: 'src/types/**'
35+
36+
readme:
37+
- changed-files:
38+
- any-glob-to-any-file: 'README.md'
39+
40+
changelog:
41+
- changed-files:
42+
- any-glob-to-any-file: 'CHANGELOG.md'
43+
44+
dependency:
45+
- changed-files:
46+
- any-glob-to-any-file: 'package.json'
47+
- any-glob-to-any-file: 'package-lock.json'
48+
49+
docs:
50+
- changed-files:
51+
- any-glob-to-any-file: 'docs/**'
52+
53+
scripts:
54+
- changed-files:
55+
- any-glob-to-any-file: 'scripts/**'
56+
57+
env:
58+
- changed-files:
59+
- any-glob-to-any-file: '.env*'
60+
61+
feature:
62+
- head-branch: ['^feature-']
63+
64+
hotfix:
65+
- head-branch: ['^hotfix-']
66+

.github/workflows/code-coverage.yml

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,70 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12-
coverage:
12+
coverage-comment-lcov:
13+
name: 📝 PR Raw Coverage Table
14+
runs-on: ubuntu-raw
15+
permissions:
16+
pull-requests: write
17+
contents: read
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Install dependencies
21+
run: npm ci
22+
23+
- name: Run coverage and save output
24+
run: npm run test:coverage > test-results.txt || true
25+
26+
- name: Beautify coverage table for PR comment
27+
run: |
28+
echo '### Jest Coverage Report' > coverage-comment.md
29+
echo '' >> coverage-comment.md
30+
echo '```' >> coverage-comment.md
31+
grep -A 100 "-------------------------" test-results.txt | grep -B 100 "===============================" >> coverage-comment.md
32+
echo '```' >> coverage-comment.md
33+
echo '' >> coverage-comment.md
34+
grep "Statements" test-results.txt >> coverage-comment.md
35+
grep "Branches" test-results.txt >> coverage-comment.md
36+
grep "Functions" test-results.txt >> coverage-comment.md
37+
grep "Lines" test-results.txt >> coverage-comment.md
38+
39+
- name: Post beautified coverage comment
40+
uses: marocchino/sticky-pull-request-comment@v2
41+
with:
42+
recreate: true
43+
path: coverage-comment.md
44+
45+
coverage-comment:
46+
name: 📝 PR Coverage Summary
47+
runs-on: ubuntu-latest
48+
permissions:
49+
pull-requests: write
50+
contents: read
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: actions/setup-node@v4
54+
with:
55+
node-version: 22
56+
cache: 'npm'
57+
- name: Install dependencies
58+
run: npm ci
59+
- name: Run coverage
60+
run: npm run test:coverage
61+
- name: Comment coverage summary
62+
uses: irongut/CodeCoverageSummary@v1.3.0
63+
with:
64+
filename: reports/coverage/cobertura-coverage.xml
65+
badge: true
66+
format: markdown
67+
output: both
68+
- name: Post coverage comment
69+
uses: marocchino/sticky-pull-request-comment@v2
70+
with:
71+
recreate: true
72+
path: code-coverage-results.md
73+
74+
coverage-upload-codecov:
75+
name: 📤 Upload Coverage to Codecov
1376
runs-on: ubuntu-latest
1477
steps:
1578
- name: ⬇️ Checkout repository

.github/workflows/labeler.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 🏷️ Pull Request Labeler
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
workflow_dispatch:
7+
schedule:
8+
- cron: "0 1 * * 1"
9+
10+
jobs:
11+
label:
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
issues: write
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/labeler@v5
19+
with:
20+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stale.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: 💤 Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # every day
6+
workflow_dispatch:
7+
8+
jobs:
9+
stale:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/stale@v9
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
stale-issue-message: 'This issue is stale because it has been open for 90 days with no activity.'
16+
stale-pr-message: 'This pull request is stale because it has been open for 90 days with no activity.'
17+
days-before-stale: 90
18+
days-before-close: 7
19+
close-issue-message: 'This issue was closed due to inactivity.'
20+
close-pr-message: 'This pull request was closed due to inactivity.'

0 commit comments

Comments
 (0)