Skip to content

Commit 255ec2b

Browse files
committed
APM-7202-Github-bestpractices
1 parent dacb87f commit 255ec2b

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ jobs:
88
runs-on: ubuntu-22.04
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
11+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1212
with:
13-
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
13+
fetch-depth: 0 # This causes all history to be fetched, which is required for calculate-version to function
1414

1515
- name: Install Python 3.9
16-
uses: actions/setup-python@v5
16+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
1717
with:
1818
python-version: 3.9
1919

@@ -30,33 +30,35 @@ jobs:
3030
run: pip install "poetry<2.0.0"
3131

3232
- name: Cache poetry packages
33-
uses: actions/cache@v4
33+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
3434
with:
3535
path: ~/.cache/pypoetry
36-
key: ${{ runner.os }}-build-cache-poetry-packages-${{ hashFiles('**/poetry.lock') }}
36+
key: ${{ runner.os }}-build-cache-poetry-packages-${{
37+
hashFiles('**/poetry.lock') }}
3738

3839
- name: Cache node modules
39-
uses: actions/cache@v4
40+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
4041
with:
4142
path: ~/.npm
42-
key: ${{ runner.os }}-build-cache-npm-packages-${{ hashFiles('**/package-lock.json') }}
43+
key: ${{ runner.os }}-build-cache-npm-packages-${{
44+
hashFiles('**/package-lock.json') }}
4345

4446
- name: Install repo
4547
run: make install
4648

4749
- name: Set SPEC_VERSION env var
48-
run: echo ::set-env name=SPEC_VERSION::$(poetry run python scripts/calculate_version.py)
50+
run: echo ::set-env name=SPEC_VERSION::$(poetry run python
51+
scripts/calculate_version.py)
4952
env:
5053
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
5154

5255
- name: Create release (master only)
5356
id: create-release
5457
if: github.ref == 'refs/heads/master'
55-
uses: actions/create-release@v1
58+
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
5659
continue-on-error: true
5760
env:
5861
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5962
with:
6063
tag_name: ${{ env.SPEC_VERSION }}
6164
release_name: ${{ env.SPEC_VERSION }}
62-

.github/workflows/sbom.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ jobs:
2424
contents: write
2525
steps:
2626
- name: Checkout
27-
uses: actions/checkout@v5
27+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2828

2929
- name: Setup Python 3.13
30-
uses: actions/setup-python@v5
30+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
3131
with:
3232
python-version: "3.13"
3333

@@ -69,7 +69,7 @@ jobs:
6969
python .github/scripts/sbom_json_to_csv.py sbom.json SBOM_${REPO_NAME}.csv
7070
7171
- name: Upload SBOM CSV as artifact
72-
uses: actions/upload-artifact@v4
72+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
7373
with:
7474
name: sbom-csv
7575
path: SBOM_${{ github.event.repository.name }}.csv
@@ -81,18 +81,15 @@ jobs:
8181
- name: Scan SBOM for Vulnerabilities (JSON)
8282
run: |
8383
grype sbom:sbom.json -o json > grype-report.json
84-
85-
8684
8785
- name: Convert Grype JSON to CSV
8886
run: |
8987
pip install --upgrade pip
9088
REPO_NAME=$(basename $GITHUB_REPOSITORY)
9189
python .github/scripts/grype_json_to_csv.py grype-report.json grype-report-${REPO_NAME}.csv
9290
93-
9491
- name: Upload Vulnerability Report
95-
uses: actions/upload-artifact@v4
92+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
9693
with:
9794
name: grype-report
9895
path: grype-report-${{ github.event.repository.name }}.csv
@@ -104,7 +101,7 @@ jobs:
104101
python .github/scripts/sbom_packages_to_csv.py sbom.json $REPO_NAME
105102
106103
- name: Upload Package Inventory CSV
107-
uses: actions/upload-artifact@v4
104+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
108105
with:
109106
name: sbom-packages
110-
path: sbom-packages-${{ github.event.repository.name }}.csv
107+
path: sbom-packages-${{ github.event.repository.name }}.csv

0 commit comments

Comments
 (0)