Skip to content

Commit

Permalink
Updates to the loader for Integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
tlawrie committed Mar 25, 2024
1 parent fdadb55 commit f1c6b9c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1878,4 +1878,47 @@ public void v4ConvertWorkflowTemplateTaskRef(MongoDatabase db) throws IOExceptio
wftCollection.replaceOne(eq("_id", entity.getObjectId("_id")), entity);
}
}

/*
* Update Integration Template
*/
@ChangeSet(order = "4036", id = "4036", author = "Tyson Lawrie")
public void updateIntegrationTemplates(MongoDatabase db) throws IOException {
logger.info("Update Sleep Task Template");
final List<String> taskTemplates =
fileloadingService.loadFiles("flow/4036/*.json");
for (final String template : taskTemplates) {
final Document doc = Document.parse(template);
final MongoCollection<Document> collection =
db.getCollection(workflowCollectionPrefix + "integration_templates");
collection.replaceOne(eq("name", doc.get("name")), doc);
}
}



/*
* Add GitHub App Name to Integration Setting
*/
@ChangeSet(order = "4037", id = "4037", author = "Tyson Lawrie")
public void v4AdjustIntegrationSettings(MongoDatabase db) throws IOException {
logger.info("Adjust Extension Settings");
String collectionName = workflowCollectionPrefix + "settings";
MongoCollection<Document> collection = db.getCollection(collectionName);

Document setting =
(Document) collection.find(eq("_id", new ObjectId("62a7bec0a6166d30aff64a5b"))).first();
List<Document> configs = (List<Document>) setting.get("config");
Document ghAppNameConfig = new Document();
ghAppNameConfig.put("key", "github.appName");
ghAppNameConfig.put("description", "The GitHub App Name");
ghAppNameConfig.put("label", "GitHub App Name");
ghAppNameConfig.put("type", "text");
ghAppNameConfig.put("value", "");
ghAppNameConfig.put("readOnly", false);
configs.add(ghAppNameConfig);
setting.replace("config", configs);
collection.replaceOne(eq("_id", new ObjectId("62a7bec0a6166d30aff64a5b")),
setting);
}
}
8 changes: 8 additions & 0 deletions src/main/resources/flow/4036/github.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "GitHub",
"type": "github_app",
"description": "Integrate with GitHub and receive related events",
"icon": "https://vercel.com/_next/image?url=https%3A%2F%2Fimages.ctfassets.net%2Fe5382hct74si%2F1QAkKuUQwpCKWozZN5GRph%2Fe2471e32b0dbc9fb74779d5909e939ad%2FFrame_4.png&w=3840&q=75&dpl=dpl_2LT6R8QY6etDhPFWrUq4QJcVhwAR",
"instructions": "### Enable\n\nTo enable this integration, you will be asked:\n- to accept the GitHub App permissions, and\n- select a GitHub organisation to install into.\n\nOnce you have installed the app, you will be redirected back to complete the integration by choosing which team to link the app to.\n\n### Disable\n\nTo disable this integration, you can either\n- remove the GitHub App installation from your GitHub organisation, or\n- unlink the app by reopening this integration modal and selecting 'disable'",
"link": "https://github.com/apps/{app_name}/installations/select_target"
}

0 comments on commit f1c6b9c

Please sign in to comment.