-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #672 from github/lcartey/remove-acls
Remove ACLs for automated testing dispatch targets
- Loading branch information
Showing
4 changed files
with
64 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Check current actor permissions | ||
description: | | ||
Checks whether the current actor has the specified permssions | ||
inputs: | ||
minimum-permission: | ||
description: | | ||
The minimum required permission. One of: read, write, admin | ||
required: true | ||
outputs: | ||
has-permission: | ||
description: "Whether the actor had the minimum required permission" | ||
value: ${{ steps.check-permission.outputs.has-permission }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/github-script@v7 | ||
id: check-permission | ||
with: | ||
script: | | ||
// Valid permissions are none, read, write, admin (legacy base permissions) | ||
const permissionsRanking = ["none", "read", "write", "admin"]; | ||
const minimumPermission = core.getInput('minimum-permission'); | ||
if (!permissionsRanking.includes(minimumPermission)) { | ||
core.setFailed(`Invalid minimum permission: ${minimumPermission}`); | ||
return; | ||
} | ||
const { data : { permission : actorPermission } } = await github.rest.repos.getCollaboratorPermissionLevel({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
username: tools.context.actor | ||
}); | ||
// Confirm whether the actor permission is at least the selected permission | ||
const hasPermission = permissionsRanking.indexOf(minimumPermission) <= permissionsRanking.indexOf(actorPermission) ? "1" : ""; | ||
core.setOutput('has-permission', hasPermission); | ||
if (!hasPermission) { | ||
core.info(`Current actor (${tools.context.actor}) does not have the minimum required permission '${minimumPermission}' (has '${actorPermission}')`); | ||
} else { | ||
core.info(`Current actor (${tools.context.actor}) has the minimum required permission '${minimumPermission}' (has '${actorPermission}')`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters