-
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 branch 'main' into lcartey/contracts
- Loading branch information
Showing
1,577 changed files
with
19,976 additions
and
4,283 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,49 @@ | ||
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 | ||
env: | ||
INPUT_MINIMUM-PERMISSION: ${{ inputs.minimum-permission }} | ||
with: | ||
script: | | ||
// Valid permissions are none, read, write, admin (legacy base permissions) | ||
const permissionsRanking = ["none", "read", "write", "admin"]; | ||
// Note: core.getInput doesn't work by default in a composite action - in this case | ||
// it would try to fetch the input to the github-script instead of the action | ||
// itself. Instead, we set the appropriate magic env var with the actions input. | ||
// See: https://github.com/actions/runner/issues/665 | ||
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: 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 (${context.actor}) does not have the minimum required permission '${minimumPermission}' (has '${actorPermission}')`); | ||
} else { | ||
core.info(`Current actor (${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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
# Check for updates to GitHub Actions every week | ||
interval: "weekly" |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.