-
-
Notifications
You must be signed in to change notification settings - Fork 53
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 #74 from peter-evans/dev
Support triage and maintain permission levels
- Loading branch information
Showing
10 changed files
with
170 additions
and
26 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {GitHubHelper} from '../lib/github-helper' | ||
|
||
const token: string = process.env['REPO_SCOPED_PAT'] || 'not set' | ||
|
||
describe('github-helper tests', () => { | ||
it('tests getActorPermission returns "none" for non-existent collaborators', async () => { | ||
const githubHelper = new GitHubHelper(token) | ||
const actorPermission = await githubHelper.getActorPermission( | ||
{owner: 'peter-evans', repo: 'slash-command-dispatch'}, | ||
'collaborator-does-not-exist' | ||
) | ||
expect(actorPermission).toEqual('none') | ||
}) | ||
|
||
it('tests getActorPermission returns "admin"', async () => { | ||
const githubHelper = new GitHubHelper(token) | ||
const actorPermission = await githubHelper.getActorPermission( | ||
{owner: 'peter-evans', repo: 'slash-command-dispatch'}, | ||
'peter-evans' | ||
) | ||
expect(actorPermission).toEqual('admin') | ||
}) | ||
|
||
it('tests getActorPermission returns "write"', async () => { | ||
const githubHelper = new GitHubHelper(token) | ||
const actorPermission = await githubHelper.getActorPermission( | ||
{owner: 'peter-evans', repo: 'slash-command-dispatch'}, | ||
'actions-bot' | ||
) | ||
expect(actorPermission).toEqual('write') | ||
}) | ||
|
||
it('tests getActorPermission returns "triage" for an org repository collaborator', async () => { | ||
const githubHelper = new GitHubHelper(token) | ||
const actorPermission = await githubHelper.getActorPermission( | ||
{owner: 'slash-command-dispatch', repo: 'integration-test-fixture'}, | ||
'test-case-machine-user' | ||
) | ||
expect(actorPermission).toEqual('triage') | ||
}) | ||
}) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import {Octokit as Core} from '@octokit/core' | ||
import {paginateRest} from '@octokit/plugin-paginate-rest' | ||
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods' | ||
|
||
export {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods' | ||
export {OctokitOptions} from '@octokit/core/dist-types/types' | ||
|
||
export const Octokit = Core.plugin(paginateRest, restEndpointMethods) | ||
|
||
export {PullsGetResponseData} from '@octokit/types' | ||
|
||
export {graphql} from '@octokit/graphql' | ||
export {graphql as Graphql} from '@octokit/graphql/dist-types/types' |