Skip to content

Commit

Permalink
ci:
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustav-Eikaas committed Dec 20, 2023
1 parent c88c072 commit 74467cc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/helpers/src/issue-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { Command } from 'commander';
import { getOctokit, context } from '@actions/github';
import { setSecret } from '@actions/core';

const program = new Command();
type Octo = ReturnType<typeof getOctokit>;
Expand Down Expand Up @@ -36,13 +37,15 @@ program
throw new Error('Missing pr number');
}

setSecret(args.token);

const client = getOctokit(args.token);
checkIssues(client, parseInt(args.pr));
checkIssues(client, parseInt(args.pr), args.token);
});

await program.parseAsync();

async function checkIssues(client: Octo, pr: number) {
async function checkIssues(client: Octo, pr: number, token: string) {
const pullRequests = await client.graphql({
query: `query($owner: String!, $name: String!, $number: Int!) {
repository (owner: $owner, name: $name){
Expand All @@ -57,6 +60,9 @@ async function checkIssues(client: Octo, pr: number) {
owner: context.repo.owner,
name: context.repo.repo,
number: pr,
headers: {
authorization: token,
},
});

const linkedIssues: number = (pullRequests as any).repository.pullRequest.closingIssuesReferences.totalCount;
Expand Down

0 comments on commit 74467cc

Please sign in to comment.