Skip to content

Commit 731e74f

Browse files
committed
refactor: Try setting permisions for job
Signed-off-by: Naren Dasan <[email protected]> Signed-off-by: Naren Dasan <[email protected]>
1 parent e28800e commit 731e74f

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

.github/workflows/linter.yml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,54 @@ on:
77
jobs:
88
cpp-linting:
99
name: C++ Linting
10-
runs-on: ubuntu-18.04
11-
container:
12-
image: ghcr.io/nvidia/torch-tensorrt/docgen:latest
13-
credentials:
14-
username: ${{ github.actor }}
15-
password: ${{ secrets.GITHUB_TOKEN }}
10+
runs-on: ubuntu-latest
11+
permissions:
12+
packages: read
1613
steps:
1714
- uses: actions/checkout@v2
1815
with:
1916
ref: ${{ github.event.pull_request.head.sha }}
17+
- name: Docker login
18+
uses: docker/login-action@v1
19+
with:
20+
registry: ghcr.io
21+
username: ${{ github.actor }}
22+
password: ${{ secrets.GITHUB_TOKEN }}
2023
- name: Run image
21-
run: cp $GITHUB_WORKSPACE/docker/WORKSPACE.docs $GITHUB_WORKSPACE/WORKSPACE
22-
- name: Install dependencies
23-
run: pip3 install -r $GITHUB_WORKSPACE/.github/scripts/requirements.txt
24-
- name: Lint C++
2524
run: |
26-
ln -s $GITHUB_EVENT_PATH /GITHUB_EVENT.json
27-
python3 .github/scripts/run_cpp_linter.py
25+
docker run -it -d --name cpplinter -e GITHUB_TOKEN=$GITHUB_TOKEN -v $GITHUB_WORKSPACE:/workspace -v $GITHUB_EVENT_PATH:/GITHUB_EVENT.json -w /workspace ghcr.io/nvidia/torch-tensorrt/docgen:latest
26+
docker exec cpplinter bash -c "cp /workspace/docker/WORKSPACE.docs /workspace/WORKSPACE"
2827
env:
2928
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
29+
- name: Install dependencies
30+
run: docker exec cpplinter bash -c "pip3 install -r /workspace/.github/scripts/requirements.txt"
31+
- name: Lint C++
32+
run: docker exec cpplinter bash -c "cd /workspace && python3 /workspace/.github/scripts/run_cpp_linter.py"
3033

3134
py-linting:
3235
name: Python Linting
33-
runs-on: ubuntu-18.04
34-
container:
35-
image: ghcr.io/nvidia/torch-tensorrt/docgen:latest
36-
credentials:
37-
username: ${{ github.actor }}
38-
password: ${{ secrets.GITHUB_TOKEN }}
36+
runs-on: ubuntu-latest
37+
permissions:
38+
packages: read
3939
steps:
4040
- uses: actions/checkout@v2
4141
with:
4242
ref: ${{ github.event.pull_request.head.sha }}
43+
- name: Docker login
44+
uses: docker/login-action@v1
45+
with:
46+
registry: ghcr.io
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
4349
- name: Run image
44-
run: cp $GITHUB_WORKSPACE/docker/WORKSPACE.docs $GITHUB_WORKSPACE/WORKSPACE
45-
- name: Install dependencies
46-
run: |
47-
pip3 install -r $GITHUB_WORKSPACE/.github/scripts/requirements.txt
48-
pip3 install -r $GITHUB_WORKSPACE/tools/linter/requirements.txt
49-
- name: Lint python
5050
run: |
51-
ln -s $GITHUB_EVENT_PATH /GITHUB_EVENT.json
52-
python3 $GITHUB_WORKSPACE.github/scripts/run_py_linter.py
51+
docker run -it -d --name pylinter -e GITHUB_TOKEN=$GITHUB_TOKEN -v $GITHUB_WORKSPACE:/workspace -v $GITHUB_EVENT_PATH:/GITHUB_EVENT.json -w /workspace ghcr.io/nvidia/torch-tensorrt/docgen:latest
52+
docker exec pylinter bash -c "cp /workspace/docker/WORKSPACE.docs /workspace/WORKSPACE"
5353
env:
5454
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
55+
- name: Install dependencies
56+
run: |
57+
docker exec pylinter bash -c "pip3 install -r /workspace/.github/scripts/requirements.txt"
58+
docker exec pylinter bash -c "pip3 install -r /workspace/tools/linter/requirements.txt"
59+
- name: Lint Python
60+
run: docker exec pylinter bash -c "cd /workspace && python3 /workspace/.github/scripts/run_py_linter.py"

0 commit comments

Comments
 (0)