Skip to content

Commit 57fdf62

Browse files
committed
Refactor run.js to remove enterprise input handling and update date references
- Removed the handling of the 'enterprise' input as it is no longer required. - Updated the logic to only require 'organization' when 'team' is provided. - Changed references from 'day' to 'date' in the fetched Copilot usage data. - Adjusted the job summary creation logic to reflect the removal of enterprise handling. - Updated output keys to use 'date' instead of 'day' for consistency.
1 parent e1315a0 commit 57fdf62

File tree

4 files changed

+22
-34
lines changed

4 files changed

+22
-34
lines changed

dist/index.js

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -132052,7 +132052,6 @@ const getInputs = () => {
132052132052
const result = {};
132053132053
result.token = (0,core.getInput)("github-token").trim();
132054132054
result.organization = (0,core.getInput)("organization").trim();
132055-
result.enterprise = (0,core.getInput)("enterprise").trim();
132056132055
result.team = (0,core.getInput)("team").trim();
132057132056
result.jobSummary = (0,core.getBooleanInput)("job-summary");
132058132057
result.days = parseInt((0,core.getInput)("days"));
@@ -132089,13 +132088,7 @@ const run = async () => {
132089132088
params.until = input.until;
132090132089
}
132091132090
let req;
132092-
if (input.enterprise) {
132093-
req = octokit.paginate("GET /enterprises/{enterprise}/copilot/usage", {
132094-
enterprise: input.enterprise,
132095-
...params
132096-
});
132097-
}
132098-
else if (input.team) {
132091+
if (input.team) {
132099132092
if (!input.organization) {
132100132093
throw new Error("organization is required when team is provided");
132101132094
}
@@ -132121,18 +132114,19 @@ const run = async () => {
132121132114
return (0,external_console_.warn)("No Copilot usage data found");
132122132115
}
132123132116
(0,core.debug)(JSON.stringify(data, null, 2));
132124-
(0,core.info)(`Fetched Copilot usage data for ${data.length} days (${data[0].day} to ${data[data.length - 1].day})`);
132117+
console.log(JSON.stringify(data, null, 2));
132118+
(0,core.info)(`Fetched Copilot usage data for ${data.length} days (${data[0].date} to ${data[data.length - 1].date})`);
132125132119
if (input.jobSummary) {
132126132120
setJobSummaryTimeZone(input.timeZone);
132127-
const name = input.enterprise || (input.team && input.organization) ? `${input.organization} / ${input.team}` : input.organization;
132121+
const name = (input.team && input.organization) ? `${input.organization} / ${input.team}` : input.organization;
132128132122
await job_summary_createJobSummaryUsage(data, name).write();
132129132123
if (input.organization && !input.team) {
132130132124
(0,core.info)(`Fetching Copilot details for organization ${input.organization}`);
132131-
const orgSeatInfo = await octokit.rest.copilot.getCopilotOrganizationDetails({
132125+
const orgCopilotDetails = await octokit.rest.copilot.getCopilotOrganizationDetails({
132132132126
org: input.organization
132133-
});
132134-
if (orgSeatInfo?.data) {
132135-
await createJobSummarySeatInfo(orgSeatInfo.data).write();
132127+
}).then(response => response.data);
132128+
if (orgCopilotDetails) {
132129+
await createJobSummarySeatInfo(orgCopilotDetails).write();
132136132130
}
132137132131
(0,core.info)(`Fetching Copilot seat assignments for organization ${input.organization}`);
132138132132
const orgSeatAssignments = await octokit.paginate(octokit.rest.copilot.listCopilotSeats, {
@@ -132167,8 +132161,8 @@ const run = async () => {
132167132161
}
132168132162
}
132169132163
(0,core.setOutput)("result", JSON.stringify(data));
132170-
(0,core.setOutput)("since", data[0].day);
132171-
(0,core.setOutput)("until", data[data.length - 1].day);
132164+
(0,core.setOutput)("since", data[0].date);
132165+
(0,core.setOutput)("until", data[data.length - 1].date);
132172132166
(0,core.setOutput)("days", data.length.toString());
132173132167
};
132174132168
/* harmony default export */ const src_run = (run);

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/run.js

Lines changed: 10 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/run.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)