简体   繁体   中英

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

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.

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 …)

eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM