Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
renzhc
diffusers_dcu
Commits
7007feba
Unverified
Commit
7007feba
authored
Mar 01, 2025
by
Dhruv Nair
Committed by
GitHub
Mar 01, 2025
Browse files
[CI] Update Stylebot Permissions (#10931)
update
parent
d230ecc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
.github/workflows/pr_style_bot.yml
.github/workflows/pr_style_bot.yml
+22
-1
No files found.
.github/workflows/pr_style_bot.yml
View file @
7007feba
...
@@ -9,12 +9,33 @@ permissions:
...
@@ -9,12 +9,33 @@ permissions:
pull-requests
:
write
pull-requests
:
write
jobs
:
jobs
:
run-style-bot
:
check-permissions
:
if
:
>
if
:
>
contains(github.event.comment.body, '@bot /style') &&
contains(github.event.comment.body, '@bot /style') &&
github.event.issue.pull_request != null
github.event.issue.pull_request != null
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
outputs
:
is_authorized
:
${{ steps.check_user_permission.outputs.has_permission }}
steps
:
-
name
:
Check user permission
id
:
check_user_permission
uses
:
actions/github-script@v6
with
:
script
:
|
const comment_user = context.payload.comment.user.login;
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
owner: context.repo.owner,
repo: context.repo.repo,
username: comment_user
});
const authorized = permission.permission === 'admin';
console.log(`User ${comment_user} has permission level: ${permission.permission}, authorized: ${authorized} (only admins allowed)`);
core.setOutput('has_permission', authorized);
run-style-bot
:
needs
:
check-permissions
if
:
needs.check-permissions.outputs.is_authorized == 'true'
runs-on
:
ubuntu-latest
steps
:
steps
:
-
name
:
Extract PR details
-
name
:
Extract PR details
id
:
pr_info
id
:
pr_info
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment