-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (115 loc) · 3.66 KB
/
pull_request_checks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: "Pull Request Checks"
on:
pull_request:
jobs:
##
# setup
##
install:
name: "Install"
runs-on: ubuntu-latest
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "🔧 Setup"
uses: ./.github/actions/use-npm-dependencies
get_changed_files:
name: "Get Changed Files"
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.get_changed_files.outputs.result }}
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "📥 Get List"
id: get_changed_files
uses: actions/github-script@v7
with:
debug: true
result-encoding: string
script: |
const changedFiles = await github.rest.pulls.listFiles({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
return changedFiles.data.map(f => f.filename).join(',');
##
# validation
##
validate_pr_title:
name: "Validate PR Title"
needs: install
runs-on: ubuntu-latest
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "🔧 Setup"
uses: ./.github/actions/use-npm-dependencies
- name: "📥 Get PR Title"
id: get_pr_title
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { data } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
});
return data.title;
- name: "✅ Validate"
run: echo "${{ steps.get_pr_title.outputs.result }}" | npx commitlint
##
# lint, type check and test
##
check_types_js_client:
name: "Types Check: js-client"
needs: [install, get_changed_files, validate_pr_title]
runs-on: ubuntu-latest
if: contains(needs.get_changed_files.outputs.changed_files, 'packages/js-client/')
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "🔧 Setup"
uses: ./.github/actions/use-npm-dependencies
- name: "🔍 Type Check"
run: npm run check:types --workspace=@kibisis/pinakion-js-client
lint_contract:
name: "Lint: contract"
needs: [install, get_changed_files, validate_pr_title]
runs-on: ubuntu-latest
if: contains(needs.get_changed_files.outputs.changed_files, 'packages/contract/')
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "🔧 Setup"
uses: ./.github/actions/use-npm-dependencies
- name: "👕 Lint"
run: npm run lint:contract
lint_js_client:
name: "Lint: js-client"
needs: [install, get_changed_files, validate_pr_title]
runs-on: ubuntu-latest
if: contains(needs.get_changed_files.outputs.changed_files, 'packages/js-client/')
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "🔧 Setup"
uses: ./.github/actions/use-npm-dependencies
- name: "👕 Lint"
run: npm run lint:js-client
test_js_client:
name: "Test: js-client"
needs: [install, get_changed_files, validate_pr_title]
runs-on: ubuntu-latest
if: contains(needs.get_changed_files.outputs.changed_files, 'packages/js-client/')
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "🔧 Setup npm Dependencies"
uses: ./.github/actions/use-npm-dependencies
- name: "🔧 Setup AlgoKit"
uses: ./.github/actions/use-algokit
- name: "🧪 Test"
run: npm run test:js-client