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 5c52022 commit e687765
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22402,9 +22402,11 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
if (!input.deployUsersDryRun) {
core.info(`Assigning ${user.login} a Copilot seat in ${user.organization}`);
try {
yield octokit.request(`POST /orgs/${user.organization}/copilot/billing/selected_users`, {
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(typeof response.data);
}
catch (error) {
if (error instanceof request_error_1.RequestError && error.message === "Copilot Business is not enabled for this organization.") {
Expand Down
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ const run = async (): Promise<void> => {
let allInactiveSeats: SeatWithOrg[] = [];
let allRemovedSeatsCount = 0;
let allSeatsCount = 0;
// let deployedSeatsCount = 0;

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

Expand Down Expand Up @@ -421,9 +422,13 @@ const run = async (): Promise<void> => {
if (!input.deployUsersDryRun) {
core.info(`Assigning ${user.login} a Copilot seat in ${user.organization}`);
try {
await octokit.request(`POST /orgs/${user.organization}/copilot/billing/selected_users`, {
const response = await octokit.request(`POST /orgs/${user.organization}/copilot/billing/selected_users`, {
selected_usernames: [`${user.login}`]
});

core.info(`Removed ${response.data} seats`);
console.log(typeof response.data);
//deployedSeatsCount += response.data.seats_cancelled;
} 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

0 comments on commit e687765

Please sign in to comment.