Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5873eec

Browse files
committed
chore: restrict who can make releases
1 parent67e1567 commit5873eec

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎.github/workflows/release.yaml‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,29 @@ env:
3232
CODER_RELEASE_NOTES:${{ inputs.release_notes }}
3333

3434
jobs:
35+
# Only allow maintainers/admins to release.
36+
check-perms:
37+
runs-on:${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
38+
steps:
39+
-name:Allow only maintainers/admins
40+
uses:actions/github-script@v7.1.0
41+
with:
42+
github-token:${{ secrets.GITHUB_TOKEN }}
43+
script:|
44+
const {data} = await github.rest.repos.getCollaboratorPermissionLevel({
45+
owner: context.repo.owner,
46+
repo: context.repo.repo,
47+
username: context.actor
48+
});
49+
const perm = data.permission; // 'pull' | 'triage' | 'push' | 'maintain' | 'admin' ,[object Object],
50+
core.info(`Actor ${context.actor} permission: ${perm}`);
51+
if (!['admin','maintain'].includes(perm)) {
52+
core.setFailed(`Denied: requires maintain or admin`);
53+
}
3554
# build-dylib is a separate job to build the dylib on macOS.
3655
build-dylib:
3756
runs-on:${{ github.repository_owner == 'coder' && 'depot-macos-latest' || 'macos-latest' }}
57+
needs:check-perms
3858
steps:
3959
# Harden Runner doesn't work on macOS.
4060
-name:Checkout
@@ -114,7 +134,7 @@ jobs:
114134

115135
release:
116136
name:Build and publish
117-
needs:build-dylib
137+
needs:[build-dylib, check-perms]
118138
runs-on:${{ github.repository_owner == 'coder' && 'depot-ubuntu-22.04-8' || 'ubuntu-latest' }}
119139
permissions:
120140
# Required to publish a release

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp