Skip to content

Commit da5dbb2

Browse files
authored
ci: pin actions workflow step hashes and use minimum permissions (#28)
1 parent d8a593c commit da5dbb2

File tree

3 files changed

+72
-51
lines changed

3 files changed

+72
-51
lines changed

.github/workflows/flake8.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Lint validation using flake8
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
78

89
jobs:
@@ -11,19 +12,24 @@ jobs:
1112
timeout-minutes: 5
1213
strategy:
1314
matrix:
14-
python-version: ['3.9']
15+
python-version:
16+
- "3.9"
17+
permissions:
18+
contents: read
1519
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
pip install -U pip
24-
pip install -e ".[testing]"
25-
# We manually upgrade it to make the builds stable
26-
pip install "flake8==6.1.0"
27-
- name: Run flake8
28-
run: |
29-
flake8 slack_discovery_sdk/
20+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
21+
with:
22+
persist-credentials: false
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2.3.4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
pip install -U pip
30+
pip install -e ".[testing]"
31+
# We manually upgrade it to make the builds stable
32+
pip install "flake8==6.1.0"
33+
- name: Run flake8
34+
run: |
35+
flake8 slack_discovery_sdk/

.github/workflows/py_compile.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,38 @@ name: Sytanx check using py_compile
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
78
jobs:
89
build:
9-
runs-on: ubuntu-latest
10+
runs-on: ubuntu-22.04
1011
timeout-minutes: 5
1112
strategy:
1213
matrix:
13-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
14+
python-version:
15+
- "3.7"
16+
- "3.8"
17+
- "3.9"
18+
- "3.10"
19+
- "3.11"
20+
permissions:
21+
contents: read
1422
steps:
15-
- uses: actions/checkout@v2
16-
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v2
18-
with:
19-
python-version: ${{ matrix.python-version }}
20-
- name: Install dependencies
21-
run: |
22-
pip install -U pip
23-
pip install -e ".[testing]"
24-
- name: Run py_compile for main code
25-
run: |
26-
find slack_discovery_sdk -name '*.py' | xargs python -m py_compile
27-
- name: Run py_compile for test code
28-
run: |
29-
find tests -name '*.py' | xargs python -m py_compile
30-
23+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
24+
with:
25+
persist-credentials: false
26+
- name: Set up Python ${{ matrix.python-version }}
27+
uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2.3.4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- name: Install dependencies
31+
run: |
32+
pip install -U pip
33+
pip install -e ".[testing]"
34+
- name: Run py_compile for main code
35+
run: |
36+
find slack_discovery_sdk -name '*.py' | xargs python -m py_compile
37+
- name: Run py_compile for test code
38+
run: |
39+
find tests -name '*.py' | xargs python -m py_compile

.github/workflows/pytype.yml

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ name: Type hint validation using pytype
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67
pull_request:
78

89
jobs:
@@ -11,19 +12,24 @@ jobs:
1112
timeout-minutes: 5
1213
strategy:
1314
matrix:
14-
python-version: ['3.9']
15+
python-version:
16+
- "3.9"
17+
permissions:
18+
contents: read
1519
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python ${{ matrix.python-version }}
18-
uses: actions/setup-python@v2
19-
with:
20-
python-version: ${{ matrix.python-version }}
21-
- name: Install dependencies
22-
run: |
23-
pip install -U pip
24-
pip install -e ".[testing]"
25-
# As pytype can change its behavior in newer versions, we manually upgrade it
26-
pip install "pytype==2023.9.27"
27-
- name: Run pytype
28-
run: |
29-
pytype slack_discovery_sdk/
20+
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
21+
with:
22+
persist-credentials: false
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@e9aba2c848f5ebd159c070c61ea2c4e2b122355e # v2.3.4
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
pip install -U pip
30+
pip install -e ".[testing]"
31+
# As pytype can change its behavior in newer versions, we manually upgrade it
32+
pip install "pytype==2023.9.27"
33+
- name: Run pytype
34+
run: |
35+
pytype slack_discovery_sdk/

0 commit comments

Comments
 (0)