Skip to content

Commit 77cc32b

Browse files
committed
Refactor job.summary.ts to include Copilot seat assignments and add organization link
1 parent 9223f43 commit 77cc32b

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/job.summary.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,12 @@ export const createJobSummarySeatAssignments = async (data: jobSummarySeatAssign
196196
.write()
197197
}
198198

199+
export const createJobSummaryFooter = async (organization: string) => {
200+
summary
201+
.addLink(`Manage Access for ${organization}`, `https://github.com/organizations/${organization}/settings/copilot/seat_management`)
202+
.write();
203+
}
204+
199205
const getTableData = (data: CopilotUsageResponse) => {
200206
const tableData = [
201207
[

src/run.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { getBooleanInput, getInput, info, setOutput } from "@actions/core";
1+
import { getBooleanInput, getInput, info, setOutput, summary } from "@actions/core";
22
import { getOctokit } from "@actions/github";
33
import { CopilotUsageResponse } from "./types";
44
import { DefaultArtifactClient } from "@actions/artifact";
55
import { writeFileSync } from "fs";
6-
import { createJobSummarySeatAssignments, createJobSummarySeatInfo, createJobSummaryUsage } from "./job.summary";
6+
import { createJobSummaryFooter, createJobSummarySeatAssignments, createJobSummarySeatInfo, createJobSummaryUsage } from "./job.summary";
77
import { createCSV } from "./csv";
88
import { Json2CsvOptions } from "json-2-csv";
99
import { debug } from "console";
@@ -112,22 +112,20 @@ const run = async (): Promise<void> => {
112112
org: input.organization
113113
});
114114
if (orgSeatInfo?.data) {
115-
createJobSummarySeatInfo(orgSeatInfo.data);
115+
await createJobSummarySeatInfo(orgSeatInfo.data);
116116
}
117117

118118
info(`Fetching Copilot seat assignments for organization ${input.organization}`);
119119
const orgSeatAssignments = await octokit.rest.copilot.listCopilotSeats({
120120
org: input.organization
121121
});
122122
if (orgSeatAssignments?.data.seats) {
123-
createJobSummarySeatAssignments(orgSeatAssignments.data);
123+
await createJobSummarySeatAssignments(orgSeatAssignments.data);
124124
}
125125
}
126126

127127
if (input.organization) {
128-
// summary
129-
// .addLink(`Manage Access for ${input.organization}`, `https://github.com/organizations/${input.organization}/settings/copilot/seat_management`)
130-
// .write()
128+
await createJobSummaryFooter(input.organization);
131129
}
132130
}
133131

0 commit comments

Comments
 (0)