Skip to content
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

Remove maintain permissions #351

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ As seen above, we have two steps. One for a noop deploy, and one for a regular d
| `unlock_trigger` | `false` | `.unlock` | The string to look for in comments as an IssueOps unlock trigger. Used for unlocking branch deployments. Example: ".unlock" |
| `help_trigger` | `false` | `.help` | The string to look for in comments as an IssueOps help trigger. Example: ".help" |
| `lock_info_alias` | `false` | `.wcid` | An alias or shortcut to get details about the current lock (if it exists) Example: ".info" - Hubbers will find the ".wcid" default helpful ("where can I deploy") |
| `permissions` | `true` | `write,maintain,admin` | The allowed GitHub permissions an actor can have to invoke IssueOps commands - Example: "write,maintain,admin" |
| `permissions` | `true` | `write,admin` | The allowed GitHub permissions an actor can have to invoke IssueOps commands - Example: "write,admin" |
| `commit_verification` | `false` | `"false"` | Whether or not to enforce commit verification before a deployment can continue. Default is `"false"`. This input option is excellent to enforce tighter security controls on your deployments. |
| `param_separator` | `false` | `\|` | The separator to use for parsing parameters in comments in deployment requests. Parameters will are saved as outputs and can be used in subsequent steps - See [Parameters](docs/parameters.md) for additional details |
| `global_lock_flag` | `false` | `--global` | The flag to pass into the lock command to lock all environments. Example: "--global" |
Expand Down
8 changes: 4 additions & 4 deletions __tests__/functions/help.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const defaultInputs = {
skipReviews: '',
draft_permitted_targets: '',
admins: 'false',
permissions: ['write', 'admin', 'maintain'],
permissions: ['write', 'admin'],
allow_sha_deployments: false,
checks: 'all',
commit_verification: true,
Expand Down Expand Up @@ -83,7 +83,7 @@ test('successfully calls help with non-defaults', async () => {
skipReviews: 'development',
draft_permitted_targets: 'development',
admins: 'monalisa',
permissions: ['write', 'admin', 'maintain'],
permissions: ['write', 'admin'],
allow_sha_deployments: true,
checks: ['test,build,security'],
ignored_checks: ['lint', 'format'],
Expand Down Expand Up @@ -121,7 +121,7 @@ test('successfully calls help with non-defaults again', async () => {
skipReviews: 'development',
draft_permitted_targets: 'development',
admins: 'monalisa',
permissions: ['write', 'admin', 'maintain'],
permissions: ['write', 'admin'],
allow_sha_deployments: false,
checks: 'required',
ignored_checks: ['lint'],
Expand Down Expand Up @@ -171,7 +171,7 @@ test('successfully calls help with non-defaults and unknown update_branch settin
skipReviews: 'development',
draft_permitted_targets: 'development',
admins: 'monalisa',
permissions: ['write', 'admin', 'maintain'],
permissions: ['write', 'admin'],
allow_sha_deployments: false,
checks: 'required',
ignored_checks: ['lint'],
Expand Down
6 changes: 3 additions & 3 deletions __tests__/functions/prechecks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ beforeEach(() => {
jest.spyOn(core, 'warning').mockImplementation(() => {})
jest.spyOn(core, 'setOutput').mockImplementation(() => {})
jest.spyOn(core, 'saveState').mockImplementation(() => {})
process.env.INPUT_PERMISSIONS = 'admin,write,maintain'
process.env.INPUT_PERMISSIONS = 'admin,write'

baseCommitWithOid = {
nodes: [
Expand Down Expand Up @@ -57,7 +57,7 @@ beforeEach(() => {
skipReviews: '',
draft_permitted_targets: '',
checks: 'all',
permissions: ['admin', 'write', 'maintain'],
permissions: ['admin', 'write'],
commit_verification: false,
ignored_checks: []
}
Expand Down Expand Up @@ -857,7 +857,7 @@ test('runs prechecks and fails due to bad user permissions', async () => {
.mockReturnValueOnce({data: {permission: 'read'}, status: 200})
expect(await prechecks(context, octokit, data)).toStrictEqual({
message:
'👋 @monalisa, that command requires the following permission(s): `admin/write/maintain`\n\nYour current permissions: `read`',
'👋 @monalisa, that command requires the following permission(s): `admin/write`\n\nYour current permissions: `read`',
status: false
})
})
Expand Down
6 changes: 3 additions & 3 deletions __tests__/functions/valid-permissions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ const setOutputMock = jest.spyOn(core, 'setOutput')

var octokit
var context
var permissions = ['write', 'maintain', 'admin']
var permissions = ['write', 'admin']

beforeEach(() => {
jest.clearAllMocks()
jest.spyOn(core, 'setOutput').mockImplementation(() => {})
process.env.INPUT_PERMISSIONS = 'write,maintain,admin'
process.env.INPUT_PERMISSIONS = 'write,admin'

context = {
actor: 'monalisa'
Expand Down Expand Up @@ -46,7 +46,7 @@ test('determines that a user has does not valid permissions to invoke the Action
})

expect(await validPermissions(octokit, context, permissions)).toEqual(
'👋 @monalisa, that command requires the following permission(s): `write/maintain/admin`\n\nYour current permissions: `read`'
'👋 @monalisa, that command requires the following permission(s): `write/admin`\n\nYour current permissions: `read`'
)
expect(setOutputMock).toHaveBeenCalledWith('actor', 'monalisa')
})
Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ inputs:
required: false
default: ".wcid"
permissions:
description: 'The allowed GitHub permissions an actor can have to invoke IssueOps commands - Example: "write,maintain,admin"'
description: 'The allowed GitHub permissions an actor can have to invoke IssueOps commands - Example: "write,admin"'
required: true
default: "write,maintain,admin"
default: "write,admin"
commit_verification:
description: 'Whether or not to enforce commit verification before a deployment can continue. Default is "false"'
required: false
Expand Down
Loading