Skip to content

Commit

Permalink
Fixes for the try GitHub Action
Browse files Browse the repository at this point in the history
1. Properly handle multi-line comments
2. Don't skip duplicate workflows when explicitly running try
  • Loading branch information
mrobinson committed Jul 25, 2023
1 parent 7508d83 commit 35cf97c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/try.yml
Expand Up @@ -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 };
Expand All @@ -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 };
}
}
Expand Down

0 comments on commit 35cf97c

Please sign in to comment.