Skip to content

Commit

Permalink
chore: test
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Sep 4, 2024
1 parent ec8dca5 commit db9dcb0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/compute.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
run: yarn

- name: execute directive
run: npx tsx ./src/main.ts
run: npx tsx ./src/workflow-entry.ts
id: plugin-name
env:
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
Expand Down
14 changes: 12 additions & 2 deletions src/handlers/repository-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,32 @@ export async function repositoryDispatch(context: Context, workflow: string) {
const repository = "telegram--bot";
const owner = "ubq-testing";
const branch = "workflows";
const octokit = await getAppOctokit(context);
const app = await getAppOctokit(context);
const installation = await app.octokit.rest.apps.getRepoInstallation({ owner, repo: repository });

// Set the installation id for the octokit instance

const octokit = await app.getInstallationOctokit(installation.data.id);

logger.info(`Dispatching workflow function: ${workflow}`);


/**
* We'll hit the main workflow entry and pass in the same inputs so
* that it essentially runs on the same context as the worker.
*/

Reflect.deleteProperty(inputs, "signature");

return await octokit.rest.actions.createWorkflowDispatch({
owner,
repo: repository,
workflow_id: "compute.yml",
ref: branch,
inputs: {
...inputs,
workflowFunction: workflow // here for the workflow logs, not used in the workflow
eventPayload: JSON.stringify(context.payload),
settings: JSON.stringify(context.config),
}
});
}
Expand Down
10 changes: 2 additions & 8 deletions src/helpers/authenticated-octokit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { App } from "octokit";
import { Context } from "../types";

export async function getAppOctokit(context: Context) {
const { env } = context;
const { APP_ID, APP_PRIVATE_KEY } = env;
const app = new App({
appId: APP_ID,
privateKey: APP_PRIVATE_KEY,
})

return app.octokit;
const { env: { APP_ID, APP_PRIVATE_KEY } } = context;
return new App({ appId: APP_ID, privateKey: APP_PRIVATE_KEY });
}

0 comments on commit db9dcb0

Please sign in to comment.