-
Notifications
You must be signed in to change notification settings - Fork 18
84 lines (80 loc) · 2.51 KB
/
phylum-daily-analysis.yaml
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
name: Daily Analysis Phylum
on:
# schedule:
# # Runs at 14:00 UTC every day
# - cron: '0 14 * * *'
push:
branches:
- DO-2628
jobs:
get_phylum_branches_to_analyze:
name: Get Branches to analyze with phylum
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: RDXWorks-actions/checkout@main
with:
fetch-depth: 0
- name: Get branches
id: get_branches
uses: RDXWorks-actions/github-script@main
with:
script: |
let branches = [];
let page = 1;
while (true) {
const response = await github.rest.repos.listBranches({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
page: page,
});
branches = branches.concat(response.data);
if (response.data.length < 100) break;
page++;
}
const branchNames = branches
.map(branch => branch.name)
.filter(name => name === 'DO-2628' || name.startsWith('release/'));
return JSON.stringify(branchNames);
- name: Set branches matrix
id: set_matrix
run: |
echo "branches=${{ steps.get_branches.outputs.result }}" >> $GITHUB_OUTPUT
analyze_branch_phylum:
name: Analyze dependencies with Phylum
needs:
- get_phylum_branches_to_analyze
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
strategy:
matrix:
branch: ${{ needs.phylum_analyze.outputs.branches }}
steps:
- uses: RDXWorks-actions/checkout@main
with:
ref: ${{ matrix.branch }}
fetch-depth: 0
- uses: RDXWorks-actions/setup-python@main
with:
python-version: 3.10.6
- name: Install Phylum
run: |
curl https://sh.phylum.io/ | sh -s -- --yes
# Add the Python user base binary directory to PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Run Phylum Analysis
env:
PHYLUM_API_KEY: ${{ secrets.PHYLUM_API_KEY }}
run: phylum analyze --quiet --label ${{ matrix.branch }}_branch_daily_schedule > /dev/null 2>&1 ||
if [ $? -eq 100 ]; then
echo "Phylum Analysis returned exit code 100, but continuing.";
exit 0;
else
exit $?;
fi