Skip to content

Instantly share code, notes, and snippets.

@ivansnag
ivansnag / scan_changed_files_gha.yaml
Created July 16, 2024 17:27
Example of a Github Actions workflow that gets the name of the services from the folder structure and file changes in the commit when a PR is merged.
name: Scan Changed Files in PR
on:
pull_request:
types:
- closed
branches:
- 'main'
jobs:
@ivansnag
ivansnag / adding_members_to_MST_team.js
Last active June 7, 2024 19:12
A CSV with the column name "email" is required. The name of that file should be set on line 73. Instructions including where to locate Constants and what permissions are required linked: https://docs.google.com/document/d/1maUzdJ6t5gpToZYmDQ1dYNLs81h1aMmd4PuRmuZ5CSs/edit?usp=sharing
const axios = require('axios');
const fs = require('fs');
const csv = require('csv-parser');
// Constants - replace these with your actual values
const CLIENT_ID = '';
const CLIENT_SECRET = '';
const TENANT_ID = '';
const TEAM_ID = '';
const fetch = require('node-fetch');
const fs = require('fs');
const csv = require('csv-parser');
const csvFilePath = 'CSV TEMPLATE';
const apiEndpoint = 'CUSTOMER SPECIFIC INCIDENTS SYNC ENDPOINT';
const apiKey = 'API KEY';
fs.createReadStream(csvFilePath)
@ivansnag
ivansnag / create_DX_servcies_from_csv.js
Created April 18, 2024 15:36
API script for creating services using the services.sync endpoint. Two output files will be created. One for error logging and one to map services to their reference_ids.
const fs = require('fs');
const csv = require('csv-parser');
const axios = require('axios');
const { v4: uuidv4 } = require('uuid');
const createCsvWriter = require('csv-writer').createObjectCsvWriter;
// Path to your CSV file
const csvFilePath = 'name_of_.csv';
const outputCsvFilePath = 'service_catalg_with_reference_id.csv';
@ivansnag
ivansnag / copy_jira_integration.js
Created May 18, 2023 22:20
Grabs JIRA integrations and their configurations from one project and copies them to another
// TODO: Create the trigger configs (ticket creation automation)
// Script will take JIRA integration configurations from a template project and copy them to another project you specify
const fetch = require('node-fetch');
const url = 'https://api.bugsnag.com/'
const auth_token = 'YOUR AUTH TOKEN'
const project_name_to_copy_from = ''
@ivansnag
ivansnag / get_events_by_release_stage.js
Created May 16, 2023 18:15
Loops through all projects and returns project name, release stage and event totals for a given number of days
// A rate limit may be hit - if so you will need to add some sleeps
const fetch = require('node-fetch');
const url = 'https://api.bugsnag.com/'
const auth_token = 'YOUR PERSONAL AUTH TOKEN'
const last_number_of_days = '100' // eg. 7 would return totals from the last week
let headers = {
headers: {
val config = Configuration.load(this)
config.addOnError(OnErrorCallback { event ->
for (breadcrumb in event.breadcrumbs.asReversed()) {
val myBreadcrumbMessage = "Navigated to" // insert string message to compare to
if (breadcrumb.message.contains(myBreadcrumbMessage)) {
val value = breadcrumb.message.substringAfter(":").substring(1)
event.addMetadata("Breadcrumb Metadata", "Navigated To", value); //adding to custom metadata
# Example of pulling audit entries
# Required: the auth token must be associated with an Organization Administrator on the account
require 'httparty'
require 'json'
@auth_token = "[YOUR AUTH TOKEN]"
@get_organizations_url= "https://api.bugsnag.com/user/organizations?admin=&per_page=10"