Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process.exit(1) on error #2

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions aad-user-sync/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58528,6 +58528,7 @@ async function getGroupsFromAzureAD(client) {

// Get the Azure AD group object for the specified group name.
async function getGroup(client, groupName) {
console.log(`Checking group "${groupName}" against Azure`);
const group = await client.api(`/groups/`).header("ConsistencyLevel", "eventual").search(`"displayName:${groupName}"`).select("id").get();
if (group.value.length > 1) {
throw new Error(`Multiple groups found with name ${groupName}`);
Expand Down Expand Up @@ -58907,14 +58908,14 @@ async function main() {
// If an error occurs, log it and continue to the next group (if configured to do so).
logError(group.displayName, error);
if (!continueOnErrors) {
break;
process.exit(1); // exit with error code
}
}
}
}

// Call the main function and log any errors.
main().catch(console.error);
main();

})();

Expand Down
4 changes: 2 additions & 2 deletions aad-user-sync/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ async function main() {
// If an error occurs, log it and continue to the next group (if configured to do so).
logError(group.displayName, error);
if (!continueOnErrors) {
break;
process.exit(1); // exit with error code
}
}
}
}

// Call the main function and log any errors.
main().catch(console.error);
main();
1 change: 1 addition & 0 deletions aad-user-sync/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ async function getGroupsFromAzureAD(client) {

// Get the Azure AD group object for the specified group name.
async function getGroup(client, groupName) {
console.log(`\tChecking group "${groupName}" exists in Azure`);
const group = await client.api(`/groups/`).header("ConsistencyLevel", "eventual").search(`"displayName:${groupName}"`).select("id").get();
if (group.value.length > 1) {
throw new Error(`Multiple groups found with name ${groupName}`);
Expand Down
4 changes: 4 additions & 0 deletions create-teams-from-directories/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inputs:
dry_run:
description: "Prevent executing commands that would make changes to GitHub"
required: false
continue_on_errors:
description: "If errors should be ignored"
required: false
default: "false"

runs:
using: "node16"
Expand Down
Loading