Skip to content

Commit 5def329

Browse files
authored
Merge pull request #139 from timlnx/scorecard-fixes
Scorecard fixes: token permissions, Dependabot, action SHA pinning
2 parents 6239a47 + 2a829f4 commit 5def329

5 files changed

Lines changed: 44 additions & 22 deletions

File tree

.github/dependabot.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
open-pull-requests-limit: 5
8+
groups:
9+
actions-minor-patch:
10+
update-types:
11+
- "minor"
12+
- "patch"
13+
14+
- package-ecosystem: "pip"
15+
directory: "/"
16+
schedule:
17+
interval: "weekly"
18+
open-pull-requests-limit: 5
19+
groups:
20+
pip-minor-patch:
21+
update-types:
22+
- "minor"
23+
- "patch"

.github/workflows/bandit.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ on:
1010
- cron: "0 0 * * 0"
1111
workflow_dispatch:
1212

13+
permissions: read-all
14+
1315
jobs:
1416
analyze:
1517
runs-on: ubuntu-latest
@@ -19,9 +21,9 @@ jobs:
1921
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2022
steps:
2123
- name: Checkout code
22-
uses: actions/checkout@v6.0.2
24+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2325

2426
- name: Perform Bandit Analysis
25-
uses: PyCQA/bandit-action@v1
27+
uses: PyCQA/bandit-action@ca64e96d362b1764a98d841aaf3a4b1e2d690c7b # v1.0.1
2628
with:
2729
targets: "bitmath/ tests/"

.github/workflows/codeql.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88
schedule:
99
- cron: "0 0 * * 0"
1010

11+
permissions: read-all
12+
1113
jobs:
1214
analyze:
1315
name: Analyze Python
@@ -21,17 +23,17 @@ jobs:
2123

2224
steps:
2325
- name: Checkout repository
24-
uses: actions/checkout@v6.0.2
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2527

2628
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@v4
29+
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
2830
with:
2931
languages: python
3032

3133
- name: Autobuild
32-
uses: github/codeql-action/autobuild@v4
34+
uses: github/codeql-action/autobuild@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
3335

3436
- name: Perform CodeQL Analysis
35-
uses: github/codeql-action/analyze@v4
37+
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
3638
with:
3739
category: "/language:python"

.github/workflows/publish.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@ on:
44
release:
55
types: [published]
66

7+
permissions: read-all
8+
79
jobs:
810
build:
911
runs-on: ubuntu-latest
1012
env:
1113
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1214
steps:
13-
- uses: actions/checkout@v6.0.2
14-
- uses: actions/setup-python@v6.2.0
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
1517
with:
1618
python-version: "3.12"
1719
- name: Build package
1820
run: pip install build && python -m build
1921
- name: Upload dist artifacts
20-
uses: actions/upload-artifact@v4
22+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2123
with:
2224
name: dist
2325
path: dist/
@@ -30,9 +32,9 @@ jobs:
3032
id-token: write
3133
steps:
3234
- name: Download dist artifacts
33-
uses: actions/download-artifact@v4
35+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
3436
with:
3537
name: dist
3638
path: dist/
3739
- name: Publish to PyPI
38-
uses: pypa/gh-action-pypi-publish@release/v1
40+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0

.github/workflows/python.yml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ name: Python CI
22

33
on: [push, pull_request]
44

5+
permissions: read-all
6+
57
jobs:
68
build:
7-
permissions:
8-
pull-requests: write
99
env:
1010
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
1111
strategy:
@@ -15,10 +15,10 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
steps:
1717
- name: "GitHub Checks it out :sunglasses-face:"
18-
uses: actions/checkout@v6.0.2
18+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1919

2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v6.2.0
21+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
2222
with:
2323
python-version: ${{ matrix.python-version }}
2424
cache: 'pip'
@@ -45,10 +45,3 @@ jobs:
4545
- name: Run Unit Tests
4646
run: |
4747
pytest -v --cov=bitmath --cov-report term-missing --cov-report term:skip-covered --cov-report xml:coverage.xml tests
48-
49-
- name: Coverage report on PR
50-
if: github.event_name == 'pull_request' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
51-
uses: MishaKav/pytest-coverage-comment@main
52-
with:
53-
pytest-xml-coverage-path: ./coverage.xml
54-
title: "Test Coverage Report"

0 commit comments

Comments
 (0)