Skip to content

Commit

Permalink
ohash
Browse files Browse the repository at this point in the history
  • Loading branch information
Aslemammad committed Mar 21, 2024
1 parent fc8493e commit 8084bec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-unjs": "^0.2.1",
"ohash": "^1.1.3",
"prettier": "^3.2.5",
"typescript": "^5.4.2"
},
Expand Down
9 changes: 4 additions & 5 deletions packages/backend/server/routes/webhook.post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ export default eventHandler(async (event) => {
secret: webhookSecret,
},
});
app.webhooks.on("workflow_job", ({ octokit, payload }) => {
console.log(payload)
app.webhooks.on("workflow_job.queued", ({ octokit, payload }) => {
console.log(payload.workflow_job.node_id)
});
// event.context.cloudflare.request.

type EmitterWebhookEvent = Parameters<typeof app.webhooks.receive>[0]
const id: EmitterWebhookEvent['id'] = event.headers.get("x-github-delivery");
const name = event.headers.get("x-github-event") as EmitterWebhookEvent['name'];
const signature = event.headers.get("x-hub-signature-256") ?? "";
const payloadString = await event.context.cloudflare.request.text();
const payload: EmitterWebhookEvent['payload'] = JSON.parse(payloadString);
const payloadString = await readRawBody(event);
const payload = await readBody<EmitterWebhookEvent['payload']>(event);

// Verify webhook signature
try {
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineCommand, runMain } from "citty";
// import { createRequire } from "module";
import { version } from "./package.json";
import {hash} from 'ohash'
import { Octokit } from "@octokit/action";
import "./environments";

Expand All @@ -14,6 +15,9 @@ const eventPayload = await import(process.env.GITHUB_EVENT_PATH, {
with: { type: "json" },
});

console.log(eventPayload)
console.log(hash(eventPayload))

// console.log(octokit)
// console.log(eventPayload)

Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8084bec

Please sign in to comment.