Skip to content

GitHub App Tutorial (Part 3)

Posted on:May 4, 2023 at 05:22 PM

General overview of the flow

This article will go through in 3 parts

  1. Install packages
yarn add oci-sdk
yarn add oci-common
yarn add xml-parser
  1. Update index.js
 * This is the main entrypoint to your Probot app
 * @param {import('probot').Probot} app
const parse = require("xml-parser");

// JavaScript
const common = require("oci-common");
// Using default configurations
const provider = new common.ConfigFileAuthenticationDetailsProvider();
const jms = require("oci-jms");

const OWNER = "lanbau";
const REPO = "sample-java-project";
const PATH = "pom.xml";

module.exports = app => {"Yay, the app was loaded!");

  app.on("push", async context => {{ event:, action: context.payload.action });

    try {
          owner: OWNER,
          repo: REPO,
          path: PATH,
        .then(res => {
          const pomData = atob(;
          const obj = parse(pomData);
          const javaVersion = obj.root.children[7].children[5].content;
          const client = new jms.JavaManagementServiceClient({
            authenticationDetailsProvider: provider,

          (async () => {
            try {
              // Create a request and dependent object(s).
              const getJavaReleaseRequest = {
                releaseVersion: javaVersion,
                opcRequestId: "GMT4UEGUMOLHIUHPFJNG123",

              // Send request to the Client.
              const getJavaReleaseResponse = await client.getJavaRelease(

                owner: OWNER,
                repo: REPO,
                  javaVersion +
                  " Security Baseline: " +
                body: `<ul>
                <li>Release version: ${getJavaReleaseResponse.javaRelease.releaseVersion}</li>
                <li>Family version: ${getJavaReleaseResponse.javaRelease.familyVersion}</li>
                <li>Parent release version: ${getJavaReleaseResponse.javaRelease.parentReleaseVersion}</li>
                <li>License type: ${getJavaReleaseResponse.javaRelease.licenseType}</li>
                <li>Release date: ${getJavaReleaseResponse.javaRelease.releaseDate}</li>
                <li>Release notes URL: ${getJavaReleaseResponse.javaRelease.releaseNotesUrl}</li>
            } catch (error) {
              console.log("getJavaRelease Failed with error  " + error);
    } catch (err) {
  1. Update Permissions of GitHub application to read contents and listen to push event
GitHub Application Tutorial GitHub Application Tutorial
  1. Go to sample-java-project & make a change
GitHub Application Tutorial GitHub Application Tutorial

You can clone the sample project at

  1. Go to the demo project’s issues.

You will see that the GitHub application has automatically created an issue in the demo project.

There are more details within the issue description which is provided by Java Management Service.

GitHub Application Tutorial GitHub Application Tutorial

This is the end of the GitHub app tutorial that demonstrate integration with Oracle’s Java Management Service.

Source Code