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

connectors.md gains Github labels for connector issues #25182

Merged
merged 6 commits into from
Apr 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -12548,7 +12548,7 @@
"sourceDefinitionId": "778daa7c-feaf-4db6-96f3-70fd645acc77",
"name": "File (CSV, JSON, Excel, Feather, Parquet)",
"dockerRepository": "airbyte/source-file",
"dockerImageTag": "0.2.37",
"dockerImageTag": "0.2.38",
"documentationUrl": "https://docs.airbyte.com/integrations/sources/file",
"icon": "file.svg",
"sourceType": "file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ public class ConnectorMarkdownGenerator {
.desc("name for the generated catalog json file").build();
private static final Options OPTIONS = new Options().addOption(PROJECT_ROOT_OPTION).addOption(SEED_ROOT_OPTION).addOption(OUTPUT_FILENAME_OPTION);

private static final String githubCodeBase = "https://github.com/airbytehq/airbyte/tree/master/airbyte-integrations/connectors";
private static final String githubOrgProject = "airbytehq/airbyte";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good golly gee I do love constants

private static final String githubCodeBase = "https://github.com/" + githubOrgProject + "/tree/master/airbyte-integrations/connectors";
private static final String githubIconBase =
"https://raw.githubusercontent.com/airbytehq/airbyte/master/airbyte-config-oss/init-oss/src/main/resources/icons";
"https://raw.githubusercontent.com/" + githubOrgProject + " /master/airbyte-config-oss/init-oss/src/main/resources/icons";
private static final String iconSize = "30";

public static void main(final String[] args) throws Exception {
Expand Down Expand Up @@ -87,11 +88,12 @@ private String buildMarkdownTable(final List<JsonNode> definitions, final String
headers.add("Image");
headers.add("Release Stage");
headers.add("Docs");
headers.add("Issues");
headers.add("Code");
headers.add("ID");

bodyParts.add("| " + String.join(" | ", headers) + " |");
bodyParts.add("|----|----|----|----|----|----|----|----|");
bodyParts.add("|----|----|----|----|----|----|----|----|----|");
for (final JsonNode definition : definitions) {
final String name = definition.get("name").asText();
final String codeName = definition.get("dockerRepository").asText().split("/")[1];
Expand All @@ -102,11 +104,19 @@ private String buildMarkdownTable(final List<JsonNode> definitions, final String
final String dockerImage = definition.get("dockerRepository").asText() + ":" + definition.get("dockerImageTag").asText();
final String releaseStage = definition.get("releaseStage") != null ? definition.get("releaseStage").asText() : "unknown";
final String documentationUrl = definition.get("documentationUrl") != null ? definition.get("documentationUrl").asText() : "";
final String docLink = !documentationUrl.equals("") ? "[link](" + documentationUrl + ")" : "missing";
final String codeLink = "[code](" + githubCodeBase + "/" + codeName + ")";
final String docLink = !documentationUrl.equals("") ? "[docs](" + documentationUrl + ")" : "missing";
// we are trying to build a string like connectors/destination/mysql. we need to determine if this
// is a source or destination, lower-case, and then append back some stuff
final String issuesLabel = "connectors/" + (codeName.contains("source-") ? "source" : "destination") + "/"
evantahler marked this conversation as resolved.
Show resolved Hide resolved
+ codeName.replace("source-", "").replace("destination-", "");
final String issuesLink =
"[" + issuesLabel + "](https://github.com/" + githubOrgProject + "/issues?q=is:open+is:issue+label:" + issuesLabel + ")";
// https://github.com/airbytehq/airbyte/issues?q=is:open+is:issue+label:connectors/destination/mysql
final String codeLink = "[" + codeName + "](" + githubCodeBase + "/" + codeName + ")";
final String id = "<small>`" + definition.get(type.toLowerCase() + "DefinitionId").asText() + "`</small>";

bodyParts.add("| **" + name + "** | " + iconLink + " | " + type + " | " + dockerImage + " | " + releaseStage + " | " + docLink + " | "
+ issuesLink + " | "
+ codeLink + " | " + id + " |");
}

Expand Down
Loading