File tree Expand file tree Collapse file tree 3 files changed +25
-18
lines changed
Expand file tree Collapse file tree 3 files changed +25
-18
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,9 @@ import { type Permissions } from "../package/permissions";
33import { permissionsJSON } from "./permissions" ;
44
55describe ( "permissionsJSON" , ( ) => {
6- test . each < [ Permissions , Record < string , unknown > ] > ( [
6+ test . each < [ Permissions , Record < string , unknown > | string ] > ( [
7+ [ "read-all" , "read-all" ] ,
8+ [ "write-all" , "write-all" ] ,
79 [ { } , { } ] ,
810 [ { actions : "read" } , { actions : "read" } ] ,
911 [
Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ import type { Permissions } from "../package/permissions";
22
33export function permissionsJSON (
44 permissions : Permissions ,
5- ) : Record < string , unknown > {
5+ ) : Record < string , unknown > | string {
6+ if ( typeof permissions === "string" ) return permissions ;
7+
68 return {
79 ...( permissions . actions && { actions : permissions . actions } ) ,
810 ...( permissions . attestations && { attestations : permissions . attestations } ) ,
Original file line number Diff line number Diff line change 11export type Permission = "read" | "write" | "none" ;
22
3- export type Permissions = {
4- actions ?: Permission ;
5- attestations ?: Permission ;
6- checks ?: Permission ;
7- contents ?: Permission ;
8- deployments ?: Permission ;
9- discussions ?: Permission ;
10- idToken ?: Permission ;
11- issues ?: Permission ;
12- packages ?: Permission ;
13- pages ?: Permission ;
14- pullRequests ?: Permission ;
15- repositoryProjects ?: Permission ;
16- securityEvents ?: Permission ;
17- statuses ?: Permission ;
18- } ;
3+ export type Permissions =
4+ | "read-all"
5+ | "write-all"
6+ | {
7+ actions ?: Permission ;
8+ attestations ?: Permission ;
9+ checks ?: Permission ;
10+ contents ?: Permission ;
11+ deployments ?: Permission ;
12+ discussions ?: Permission ;
13+ idToken ?: Permission ;
14+ issues ?: Permission ;
15+ packages ?: Permission ;
16+ pages ?: Permission ;
17+ pullRequests ?: Permission ;
18+ repositoryProjects ?: Permission ;
19+ securityEvents ?: Permission ;
20+ statuses ?: Permission ;
21+ } ;
You can’t perform that action at this time.
0 commit comments