Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a GraphQL query to retrieve all the workflows/runs from github

How to write a GraphQL query to retrieve all the workflows/runs from github I tried below query for to get node id

organization(login: "abc") {
        repositories(first: 100) {
            nodes {
                    id
                    name
                    }
                }
            }

and below query to get workflow.

    nodes(ids: "sdefrgrt") {
        ... on Workflow {
          id
          createdAt
          name
          updatedAt
        }
}
like image 809
Panda Avatar asked Oct 11 '25 09:10

Panda


1 Answers

You may get the workflow runs via:

     {
      node(id: "YOUR-WORKFLOW-NODE-ID") {
        ... on Workflow {
          runs(first: 10) {
            nodes {
              runNumber
              createdAt
              checkSuite {
                commit {
                  message
                  associatedPullRequests(first: 1) {
                    nodes {
                      number
                    }
                  }
                  history {
                    nodes {
                      author {
                        date
                        email
                        name
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

Workflow's node_id could be taken from https://docs.github.com/en/rest/actions/workflows?apiVersion=2022-11-28#get-a-workflow

like image 149
VolkanT Avatar answered Oct 13 '25 22:10

VolkanT