Skip to content

Commit 99f0cb4

Browse files
authored
[fix] [workflow]: add permissions on the workflow files (#96)
[ci][workflow]: add permissions on the workflow files
1 parent fdccccd commit 99f0cb4

8 files changed

Lines changed: 46 additions & 14 deletions

File tree

.github/workflows/backend-ci.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ on:
1212
- 'backend/**'
1313
- '.github/workflows/backend-ci.yaml'
1414

15+
permissions:
16+
contents: read
17+
pull-requests: read
18+
1519
jobs:
1620
golang-lint:
1721
name: Golang CI Lint
@@ -33,10 +37,10 @@ jobs:
3337
run: |
3438
# Install golangci-lint
3539
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.2.1
36-
40+
3741
# Add golangci-lint to PATH
3842
export PATH=$PATH:$(go env GOPATH)/bin
39-
43+
4044
# Run golangci-lint
4145
golangci-lint run --config ../.github/.golangci.yaml
4246
@@ -70,4 +74,4 @@ jobs:
7074
slug: coze-dev/cozeloop
7175
fail_ci_if_error: false
7276
verbose: true
73-
token: ${{ secrets.CODECOV_TOKEN }}
77+
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/frontend-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
- '.github/workflows/frontend-ci.yaml'
1414
workflow_dispatch:
1515

16+
permissions:
17+
contents: read
18+
pull-requests: read
19+
1620
jobs:
1721
setup:
1822
name: Build All

.github/workflows/frontend-tsc-ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
- '.github/workflows/frontend-tsc-ci.yaml'
1414
workflow_dispatch:
1515

16+
permissions:
17+
contents: read
18+
pull-requests: read
19+
1620
jobs:
1721
setup:
1822
name: TS Check

.github/workflows/idl.yaml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Thrift Syntax Validation
22

3-
on:
3+
on:
44
push:
55
paths:
66
- 'idl/**'
@@ -10,6 +10,10 @@ on:
1010
- 'idl/**'
1111
- '.github/workflows/idl.yaml'
1212

13+
permissions:
14+
contents: read
15+
pull-requests: read
16+
1317
jobs:
1418
validate-thrift:
1519
runs-on: ubuntu-latest
@@ -32,15 +36,15 @@ jobs:
3236
run: |
3337
# Initialize error flag
3438
ERROR_FOUND=0
35-
39+
3640
# Create temporary working directory
3741
TEMP_DIR=$(mktemp -d)
3842
echo "Created temporary working directory: $TEMP_DIR"
39-
43+
4044
# Initialize go mod in temp directory
4145
cd "$TEMP_DIR"
4246
go mod init dummy
43-
47+
4448
# Find all thrift files and validate them
4549
while IFS= read -r -d '' thrift_file; do
4650
echo "Validating $thrift_file..."
@@ -49,17 +53,17 @@ jobs:
4953
ERROR_FOUND=1
5054
fi
5155
done < <(find "$GITHUB_WORKSPACE/idl" -name '*.thrift' -print0)
52-
56+
5357
# Clean up temporary directory
5458
cd "$GITHUB_WORKSPACE"
5559
rm -rf "$TEMP_DIR"
5660
echo "Cleaned up temporary working directory"
57-
61+
5862
# Exit with appropriate status
5963
if [ $ERROR_FOUND -eq 1 ]; then
6064
echo "Thrift validation failed. Please check the errors above."
6165
exit 1
6266
else
6367
echo "All Thrift files validated successfully!"
6468
exit 0
65-
fi
69+
fi

.github/workflows/issue-sync.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
issues:
55
types: ['opened', 'reopened']
66

7+
permissions:
8+
contents: read
9+
pull-requests: read
10+
711
jobs:
812
sync:
913
name: Sync Issues

.github/workflows/license-check.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ on:
66
pull_request:
77
branches: ['main']
88
workflow_dispatch:
9-
9+
10+
permissions:
11+
contents: read
12+
pull-requests: read
13+
1014
jobs:
1115
license-check:
1216
name: License Check
@@ -16,11 +20,11 @@ jobs:
1620
uses: actions/setup-go@v5
1721
with:
1822
go-version: 1.23
19-
23+
2024
- name: Install license-eye
2125
run: |
2226
go install github.com/apache/skywalking-eyes/cmd/license-eye@main
23-
27+
2428
- name: Checkout
2529
uses: actions/checkout@v4
2630
with:
@@ -29,7 +33,7 @@ jobs:
2933
- name: License Header Check
3034
run: |
3135
license-eye header check -c .github/.licenserc.yaml
32-
36+
3337
- name: License Dependency Check
3438
run: |
3539
license-eye dependency check -c .github/.licenserc.yaml

.github/workflows/pr-sync.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
pull_request_target:
55
types: ['opened', 'reopened', 'closed']
66

7+
permissions:
8+
contents: read
9+
pull-requests: read
10+
711
jobs:
812
sync:
913
name: Send Lark Message

.github/workflows/semantic-pull-request.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.number }}
1212
cancel-in-progress: true
1313

14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
1418
jobs:
1519
main:
1620
name: Check Pull Request Title

0 commit comments

Comments
 (0)