Skip to content

Commit 48e0630

Browse files
committed
Addressing workflow permission security warning
1 parent 9a4c6e5 commit 48e0630

File tree

3 files changed

+62
-54
lines changed

3 files changed

+62
-54
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,36 @@ name: build
22

33
on: [push]
44

5+
permissions:
6+
contents: read
7+
58
jobs:
6-
build:
7-
name: "nextplot build, lint & test"
8-
runs-on: ubuntu-latest
9-
strategy:
10-
matrix:
11-
# Tests are currently stable only for python 3.11
12-
# due to the way we are testing
13-
python-version: ["3.11"]
14-
steps:
15-
- uses: actions/checkout@v4
9+
build:
10+
name: "nextplot build, lint & test"
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
# Tests are currently stable only for python 3.11
15+
# due to the way we are testing
16+
python-version: ["3.11"]
17+
steps:
18+
- uses: actions/checkout@v4
1619

17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v5
19-
with:
20-
python-version: ${{ matrix.python-version }}
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: ${{ matrix.python-version }}
2124

22-
# Install all development dependencies
23-
- name: Install dependencies
24-
run: |
25-
python -m pip install --upgrade pip
26-
pip install -r requirements-dev.txt
25+
# Install all development dependencies
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install -r requirements-dev.txt
2730
28-
# Lint with ruff
29-
- name: lint with ruff
30-
run: ruff check --output-format=github .
31+
# Lint with ruff
32+
- name: lint with ruff
33+
run: ruff check --output-format=github .
3134

32-
# Run the tests with pytest
33-
- name: Test with pytest
34-
run: python -m pytest -v -s
35+
# Run the tests with pytest
36+
- name: Test with pytest
37+
run: python -m pytest -v -s

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ jobs:
77
release:
88
if: ${{ github.ref_type == 'branch' }}
99
uses: nextmv-io/release/.github/workflows/release.yml@develop
10+
permissions:
11+
contents: write # Required for creating releases and tags
12+
pull-requests: write
1013
with:
1114
BRANCH: ${{ github.ref_name }}
1215
REPOSITORY: nextplot
@@ -51,6 +54,8 @@ jobs:
5154
needs: [release, publish]
5255
if: ${{ needs.release.outputs.RELEASE_NEEDED == 'true' && needs.release.outputs.SHOULD_NOTIFY_SLACK == 'true' }}
5356
uses: nextmv-io/release/.github/workflows/notify-slack.yml@develop
57+
permissions:
58+
contents: read
5459
with:
5560
PACKAGE_NAME: nextplot
5661
VERSION: ${{ needs.release.outputs.VERSION }}

.github/workflows/static.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,42 @@
22
name: pages
33

44
on:
5-
# Runs on pushes to the content branch
6-
push:
7-
branches: ["content"]
5+
# Runs on pushes to the content branch
6+
push:
7+
branches: ["content"]
88

9-
# Allows you to run this workflow manually from the Actions tab
10-
workflow_dispatch:
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
1111

1212
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
1313
permissions:
14-
contents: read
15-
pages: write
16-
id-token: write
14+
contents: read
15+
pages: write
16+
id-token: write
1717

1818
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1919
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2020
concurrency:
21-
group: "pages"
22-
cancel-in-progress: false
21+
group: "pages"
22+
cancel-in-progress: false
2323

2424
jobs:
25-
# Single deploy job since we're just deploying
26-
deploy:
27-
environment:
28-
name: github-pages
29-
url: ${{ steps.deployment.outputs.page_url }}
30-
runs-on: ubuntu-latest
31-
steps:
32-
- name: Checkout
33-
uses: actions/checkout@v4
34-
- name: Setup Pages
35-
uses: actions/configure-pages@v4
36-
- name: Upload artifact
37-
uses: actions/upload-pages-artifact@v3
38-
with:
39-
# Upload content directory
40-
path: "content/"
41-
- name: Deploy to GitHub Pages
42-
id: deployment
43-
uses: actions/deploy-pages@v4
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v4
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
# Upload content directory
40+
path: "content/"
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)