Skip to content

Commit

Permalink
Updating Workflow_Run Logs
Browse files Browse the repository at this point in the history
  • Loading branch information
DevIos01 committed Dec 22, 2023
1 parent 2ed6f79 commit 312162b
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/workflow_run.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Send Plagiarism Result On CI Complete

permissions:
actions: read
contents: read

on:
workflow_run:
workflows: ["Plagiarism Checker"]
Expand Down Expand Up @@ -33,16 +37,32 @@ jobs:
console.log("Fetching associated workflow run...");
const runId = process.env.WORKFLOW_RUN_ID;
console.log(`Looking for workflow run with ID: ${runId}`);
const runs = await github.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: '73252545',
workflow_id: 'check_plagiarism',
});
console.log(`Workflow runs fetched: ${runs.data.total_count}`);
runs.data.workflow_runs.forEach(run => {
console.log(`Run ID: ${run.id}, Name: ${run.name}, Event: ${run.event}, Status: ${run.status}`);
});
const associatedRun = runs.data.workflow_runs.find(run => run.id == runId);
if (!associatedRun || !associatedRun.pull_requests || associatedRun.pull_requests.length == 0) {
console.log("No associated pull request found.");
if (!associatedRun) {
console.log("No associated workflow run found.");
return;
}
console.log(`Operating on workflow: ${associatedRun.name}, ID: ${associatedRun.id}`);
if (!associatedRun.pull_requests || associatedRun.pull_requests.length == 0) {
console.log("No associated pull request found for this workflow run.");
return;
}
const prNumber = associatedRun.pull_requests[0].number;
console.log(`Found associated pull request: #${prNumber}`);
Expand Down

1 comment on commit 312162b

@vercel
Copy link

@vercel vercel bot commented on 312162b Dec 22, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

sprig – ./

sprig-beta.hackclub.dev
sprig-git-main.hackclub.dev
gamelab.hackclub.com
sprig.hackclub.com

Please sign in to comment.