Skip to content

Commit ef22a2a

Browse files
committed
Fix CodeQL warnings about lack of workflow permissions
1 parent c7831c6 commit ef22a2a

File tree

4 files changed

+111
-0
lines changed

4 files changed

+111
-0
lines changed

.github/workflows/linters1.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Linters
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.10'
21+
cache: 'pip'
22+
cache-dependency-path: 'pyproject.toml'
23+
- name: Install Python dependencies
24+
run: |
25+
python -m pip install -U pip pre-commit
26+
- name: Run linters
27+
run: |
28+
pre-commit run --hook-stage=manual --all-files
29+
docs:
30+
name: Docs Checks
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
with:
35+
persist-credentials: false
36+
- uses: actions/setup-python@v5
37+
with:
38+
cache: 'pip'
39+
cache-dependency-path: 'pyproject.toml'
40+
python-version: '3.10'
41+
- name: Install dependencies
42+
run: |
43+
pip install -U pip
44+
pip install -e ".[docs]"
45+
- name: Build docs
46+
run: |
47+
cd docs
48+
make html

.github/workflows/test-python-atlas.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ jobs:
5454
run: bash .github/workflows/start_local_atlas.sh mongodb/mongodb-atlas-local:7
5555
- name: Run tests
5656
run: python3 django_repo/tests/runtests.py --settings mongodb_settings -v 2
57+
permissions:
58+
contents: read

.github/workflows/test-python.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ jobs:
5555
mongodb-version: 6.0
5656
- name: Run tests
5757
run: python3 django_repo/tests/runtests_.py
58+
permissions:
59+
contents: read

.github/workflows/test-python1.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Python Tests
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**.py'
7+
- '!setup.py'
8+
- '.github/workflows/test-python.yml'
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
defaults:
16+
run:
17+
shell: bash -eux {0}
18+
19+
jobs:
20+
build:
21+
name: Django Test Suite
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout django-mongodb-backend
25+
uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
- name: install django-mongodb-backend
29+
run: |
30+
pip3 install --upgrade pip
31+
pip3 install -e .
32+
- name: Checkout Django
33+
uses: actions/checkout@v4
34+
with:
35+
repository: 'mongodb-forks/django'
36+
ref: 'mongodb-5.2.x'
37+
path: 'django_repo'
38+
persist-credentials: false
39+
- name: Install system packages for Django's Python test dependencies
40+
run: |
41+
sudo apt-get update
42+
sudo apt-get install libmemcached-dev
43+
- name: Install Django and its Python test dependencies
44+
run: |
45+
cd django_repo/tests/
46+
pip3 install -e ..
47+
pip3 install -r requirements/py3.txt
48+
- name: Copy the test settings file
49+
run: cp .github/workflows/mongodb_settings.py django_repo/tests/
50+
- name: Copy the test runner file
51+
run: cp .github/workflows/runtests.py django_repo/tests/runtests_.py
52+
- name: Start MongoDB
53+
uses: supercharge/mongodb-github-action@90004df786821b6308fb02299e5835d0dae05d0d # 1.12.0
54+
with:
55+
mongodb-version: 6.0
56+
- name: Run tests
57+
run: python3 django_repo/tests/runtests_.py
58+
permissions:
59+
contents: read

0 commit comments

Comments
 (0)