Skip to content

Commit

Permalink
Test adding capture of deployed user
Browse files Browse the repository at this point in the history
  • Loading branch information
jonjozwiak committed Jan 17, 2024
1 parent a2693be commit 31826e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22228,6 +22228,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
let allInactiveSeats = [];
let allRemovedSeatsCount = 0;
let allSeatsCount = 0;
let deployedSeatsCount = 0;
const octokit = github.getOctokit(input.token);
if (input.enterprise && input.enterprise !== null) {
core.info(`Fetching all organizations for ${input.enterprise}...`);
Expand Down Expand Up @@ -22405,9 +22406,8 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
const response = yield octokit.request(`POST /orgs/${user.organization}/copilot/billing/selected_users`, {
selected_usernames: [`${user.login}`]
});
core.info(`Removed ${response.data} seats`);
console.log(JSON.stringify(response.data, null, 2));
console.log(typeof response.data);
core.info(`Added ${response.data.seats_created} seats`);
deployedSeatsCount += response.data.seats_created;
}
catch (error) {
if (error instanceof request_error_1.RequestError && error.message === "Copilot Business is not enabled for this organization.") {
Expand Down Expand Up @@ -22462,6 +22462,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
core.setOutput('inactive-seat-count', allInactiveSeats.length.toString());
core.setOutput('seat-count', allSeatsCount.toString());
core.setOutput('removed-seats', allRemovedSeatsCount.toString());
core.setOutput('deployed-seat-count', deployedSeatsCount.toString());
});
run();

Expand Down
9 changes: 4 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const run = async (): Promise<void> => {
let allInactiveSeats: SeatWithOrg[] = [];
let allRemovedSeatsCount = 0;
let allSeatsCount = 0;
// let deployedSeatsCount = 0;
let deployedSeatsCount = 0;

const octokit = github.getOctokit(input.token);

Expand Down Expand Up @@ -426,10 +426,8 @@ const run = async (): Promise<void> => {
selected_usernames: [`${user.login}`]
});

core.info(`Removed ${response.data} seats`);
console.log(JSON.stringify(response.data, null, 2));
console.log(typeof response.data);
//deployedSeatsCount += response.data.seats_cancelled;
core.info(`Added ${response.data.seats_created} seats`);
deployedSeatsCount += response.data.seats_created;
} catch (error) {
if (error instanceof RequestError && error.message === "Copilot Business is not enabled for this organization.") {
core.error((error as Error).message + ` (${user.organization})`);
Expand Down Expand Up @@ -506,6 +504,7 @@ const run = async (): Promise<void> => {
core.setOutput('inactive-seat-count', allInactiveSeats.length.toString());
core.setOutput('seat-count', allSeatsCount.toString());
core.setOutput('removed-seats', allRemovedSeatsCount.toString());
core.setOutput('deployed-seat-count', deployedSeatsCount.toString());
};

run();

0 comments on commit 31826e9

Please sign in to comment.