Skip to content

Fix input passing in check-permissions #677

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/actions/check-permissions/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ runs:
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}`);
Expand All @@ -40,4 +46,4 @@ runs:
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}')`);
}
}
Loading