Skip to content

Commit 66d18fd

Browse files
author
DevForge Engineer
committed
fix: remove npm-publish.yml, harden CI workflow security
- Remove npm-publish.yml (wrong-language CI workflow for Python repo) - Add persist-credentials: false to all checkout steps - Add top-level permissions: contents: read to ci.yml, test.yml, publish.yml - Update actions/checkout v4->v6 and setup-python v5->v6 in ci.yml - Update actions/checkout v4->v6 in pages.yml
1 parent 32a0ac9 commit 66d18fd

5 files changed

Lines changed: 27 additions & 36 deletions

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
pull_request:
88
branches: [master]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
test:
1215
runs-on: ubuntu-latest
@@ -15,10 +18,12 @@ jobs:
1518
python-version: ["3.11", "3.12"]
1619

1720
steps:
18-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
22+
with:
23+
persist-credentials: false
1924

2025
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v5
26+
uses: actions/setup-python@v6
2227
with:
2328
python-version: ${{ matrix.python-version }}
2429

@@ -41,10 +46,12 @@ jobs:
4146
id-token: write
4247

4348
steps:
44-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v6
50+
with:
51+
persist-credentials: false
4552

4653
- name: Set up Python
47-
uses: actions/setup-python@v5
54+
uses: actions/setup-python@v6
4855
with:
4956
python-version: "3.12"
5057

.github/workflows/npm-publish.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/pages.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ jobs:
1818
build:
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
22+
with:
23+
persist-credentials: false
2224
- name: Setup Pages
2325
uses: actions/configure-pages@v5
2426
- name: Build with Jekyll

.github/workflows/publish.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
types: [ published ]
66
workflow_dispatch:
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
publish:
1013
runs-on: ubuntu-latest
@@ -14,6 +17,8 @@ jobs:
1417

1518
steps:
1619
- uses: actions/checkout@v6
20+
with:
21+
persist-credentials: false
1722

1823
- name: Set up Python
1924
uses: actions/setup-python@v6

.github/workflows/test.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
name: CI
1+
name: Test
22

33
on:
44
push:
55
branches: [master]
66
pull_request:
77
branches: [master]
88

9+
permissions:
10+
contents: read
11+
912
jobs:
1013
test:
1114
runs-on: ubuntu-latest
@@ -15,6 +18,8 @@ jobs:
1518

1619
steps:
1720
- uses: actions/checkout@v6
21+
with:
22+
persist-credentials: false
1823

1924
- name: Set up Python ${{ matrix.python-version }}
2025
uses: actions/setup-python@v6
@@ -27,7 +32,8 @@ jobs:
2732
pip install -e ".[dev]"
2833
2934
- name: Lint with ruff
30-
run: pip install ruff && ruff check src/ --target-version py310
35+
run: ruff check src/ --target-version py310
36+
3137
- name: Run tests
3238
run: |
3339
python -m pytest tests/ -v --tb=short
@@ -36,4 +42,3 @@ jobs:
3642
run: |
3743
deadcode --version
3844
deadcode --help
39-

0 commit comments

Comments
 (0)