Skip to content

Commit ef46505

Browse files
committed
Fix gha smells:
- Avoid executing scheduled workflows on forks - Use 'if' for upload-artifact action - Use permissions whenever using Github Token
1 parent b96c639 commit ef46505

5 files changed

+9
-0
lines changed

.github/workflows/build_on_pr.yml

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ jobs:
199199
200200
- name: Upload test coverage artifact
201201
uses: actions/upload-artifact@v3
202+
if: success()
202203
with:
203204
name: report
204205
path: report/

.github/workflows/compatiblity_test_on_schedule.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
matrix_preparation:
1111
name: Prepare Container List
1212
runs-on: ubuntu-latest
13+
if: ${{github.event_name != 'schedule' || github.repository == 'hpcaitech-colossalai'}}
1314
outputs:
1415
matrix: ${{ steps.set-matrix.outputs.matrix }}
1516
steps:

.github/workflows/draft_github_release_post_after_merge.yml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
name: Draft Release Post
1414
if: ( github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true ) && github.repository == 'hpcaitech/ColossalAI'
1515
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
1618
steps:
1719
- uses: actions/checkout@v2
1820
with:

.github/workflows/report_test_coverage.yml

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
report-test-coverage:
1111
runs-on: ubuntu-latest
1212
if: ${{ github.event.workflow_run.conclusion == 'success' }}
13+
permissions:
14+
contents: write
1315
steps:
1416
- name: "Download artifact"
1517
uses: actions/github-script@v6

.github/workflows/submodule.yml

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
sync-submodule:
1010
runs-on: ubuntu-latest
1111
if: github.repository == 'hpcaitech/ColossalAI'
12+
permissions:
13+
contents: write
14+
pull-requests: write
1215
steps:
1316
- name: Checkout
1417
uses: actions/checkout@v2

0 commit comments

Comments
 (0)