mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Fixes for the try GitHub Action (#30024)
1. Properly handle multi-line comments 2. Don't skip duplicate workflows when explicitly running try
This commit is contained in:
parent
7508d8321a
commit
f7fcc6e900
1 changed files with 4 additions and 3 deletions
7
.github/workflows/try.yml
vendored
7
.github/workflows/try.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
|||
})
|
||||
}
|
||||
|
||||
let tokens = "${{ github.event.comment.body }}".split(" ");
|
||||
let tokens = context.payload.comment.body.split(/\s+/);
|
||||
let tagIndex = tokens.indexOf("@bors-servo");
|
||||
if (tagIndex == -1 || tagIndex + 1 >= tokens.length) {
|
||||
return { try: false };
|
||||
|
@ -50,13 +50,14 @@ jobs:
|
|||
}
|
||||
|
||||
if (returnValue.try) {
|
||||
let username = context.payload.event.sender.login;
|
||||
let result = await github.rest.repos.getCollaboratorPermissionLevel({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
username: "${{ github.event.sender.login }}"
|
||||
username
|
||||
});
|
||||
if (!result.data.user.permissions.push) {
|
||||
makeComment('🔒 User @${{ github.event.sender.login }} does not have permission to trigger try jobs.');
|
||||
makeComment('🔒 User @' + username + ' does not have permission to trigger try jobs.');
|
||||
return { try: false };
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue