Skip to content

Commit 935dc03

Browse files
committed
Add permission for workflows
1 parent 6846184 commit 935dc03

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

.github/workflows/npm-release.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ on:
1010
- 'libCacheSim-node/**'
1111

1212
permissions:
13-
contents: read # Default permission for reading repository contents
13+
contents: read # 读取仓库内容
14+
actions: read # 读取 artifacts(如果需要)
1415

1516
env:
1617
BUILD_TYPE: Release

.github/workflows/pypi-release.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
name: Python Package
22

33
on:
4-
push:
5-
branches: ["*"]
6-
pull_request:
7-
branches: ["*"]
84
release:
95
types: [published]
106
workflow_dispatch: # Allow manual triggering
117

8+
permissions:
9+
contents: read
10+
actions: read
11+
id-token: write
12+
1213
jobs:
1314
build-wheels:
1415
name: Build wheels on ${{ matrix.os }}
@@ -103,7 +104,7 @@ jobs:
103104
name: Publish to PyPI
104105
needs: [build-wheels, build-sdist]
105106
runs-on: ubuntu-latest
106-
# if: github.event_name == 'release' && github.event.action == 'published'
107+
if: github.event_name == 'release' && github.event.action == 'published'
107108
environment:
108109
name: pypi
109110
url: https://pypi.org/p/libcachesim
@@ -133,6 +134,7 @@ jobs:
133134
name: Publish to TestPyPI
134135
needs: [build-wheels, build-sdist]
135136
runs-on: ubuntu-latest
137+
if: github.event_name == 'workflow_dispatch'
136138
environment:
137139
name: testpypi
138140
url: https://test.pypi.org/p/libcachesim

.github/workflows/python.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Python
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read # 读取仓库内容
7+
58
jobs:
69
build:
710
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)