How can I extract the user and type of the repository_dispatch trigger?

390 views Asked by At

I am triggering a repository_dispatch event from C# bot on a github workflow. How can I extract the user and the event type (which is 'run_ba' in my case, I need the info beneath "Triggered via repository dispatch 6 days ago" label in the run example picture) that triggered the run using octokit.net?

run example

I tried using GET on https://api.github.com/repos/{repoOwner}/{repoName}/actions/runs ,but did not find what I was looking for.

1

There are 1 answers

0
MarianS On

I am posting my solution here, maybe it will help someone or someone will provide a better way to do this.

-Create another job in the workflow that creates annotations for the info that I need (check_run_id …)

e.g. echo “::notice title=RunId::${{ github.run_id }}”

-Using octokit to filter workflow runs based on status -Using octokit retrieve the list of annotations based on the check_run_id from the list of workflow runs and the checksuite that is attached to annotations job.