@@ -10,23 +10,12 @@ export class ArtifactClient {
1010 */
1111 private readonly octokit : ReturnType < typeof github . getOctokit > ;
1212
13- /**
14- * Owner of the GitHub repository.
15- */
16- private readonly owner : string ;
17-
18- /**
19- * GitHub repository.
20- */
21- private readonly repo : string ;
22-
2313 /**
2414 * Initializes a new instance of the {@link ArtifactClient}.
2515 * @param token GitHub token with read and write access to actions.
2616 */
2717 constructor ( token : string ) {
2818 this . octokit = github . getOctokit ( token ) ;
29- [ this . owner , this . repo ] = process . env . GITHUB_REPOSITORY . split ( "/" ) ;
3019 }
3120
3221 /**
@@ -36,9 +25,8 @@ export class ArtifactClient {
3625 */
3726 public async del ( artifactId : number ) : Promise < boolean > {
3827 const { status } = await this . octokit . rest . actions . deleteArtifact ( {
28+ ...github . context . repo ,
3929 artifact_id : artifactId ,
40- owner : this . owner ,
41- repo : this . repo ,
4230 } ) ;
4331
4432 return this . success ( status ) ;
@@ -50,8 +38,7 @@ export class ArtifactClient {
5038 */
5139 public async list ( ) : Promise < Artifact [ ] > {
5240 const res = await this . octokit . rest . actions . listWorkflowRunArtifacts ( {
53- owner : this . owner ,
54- repo : this . repo ,
41+ ...github . context . repo ,
5542 run_id : parseInt ( process . env . GITHUB_RUN_ID ) ,
5643 } ) ;
5744
@@ -73,4 +60,3 @@ export class ArtifactClient {
7360 ) ;
7461 }
7562}
76-
0 commit comments