-
Notifications
You must be signed in to change notification settings - Fork 3.4k
59 lines (52 loc) · 1.8 KB
/
validator-poetry-lock.yml
File metadata and controls
59 lines (52 loc) · 1.8 KB
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
name: "Check"
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
- ready_for_review
branches:
- develop
- 'ls-release/**'
merge_group:
env:
ACTIONS_STEP_DEBUG: '${{ secrets.ACTIONS_STEP_DEBUG }}'
jobs:
version:
name: "Poetry Lock Change Size"
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3.0.0
- name: Validate
uses: actions/github-script@v8
env:
BASE_REF: "${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha || github.event.before }}"
HEAD_REF: "${{ github.event.merge_group.head_sha || github.event.pull_request.head.sha || github.event.after }}"
with:
github-token: ${{ secrets.GIT_PAT }}
script: |
const {repo, owner} = context.repo;
const base_ref = process.env.BASE_REF;
const head_ref = process.env.HEAD_REF;
const {data: compare} = await github.rest.repos.compareCommits({
owner,
repo,
base: base_ref,
head: head_ref,
});
const poetry_locks = compare.files.filter(e => e.filename.endsWith('poetry.lock'));
if (poetry_locks.length === 0) {
core.notice('No poetry.lock changes');
} else {
for (const poetry_lock of poetry_locks) {
core.startGroup(`${poetry_lock.filename}`);
core.info(`${poetry_lock.filename} changed`);
console.log(poetry_lock);
if (poetry_lock.changes > 50) {
core.setFailed(`${poetry_lock.filename} has too many changes: ${poetry_lock.changes}`);
}
core.endGroup();
}
}