I have been trying to get a list of commits that were pushed to my repo using the --force push command.
I am doing this to identify which commits have potentially changed the history of the branch.
I can do this via the REST API, using something like this:
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/activity
Note: you can find more info about this on using this link: https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-activities
This command lists all the activity done on the repo, including force_pushes.
I am trying to get something similar using GitHub's GraphQL API, I have tried using the GitHub GraphQL explorer to see if there are any queries that can help. I have searched under repository, ref, etc but unfortunately have had no luck. I have been able to get the list of commits that were made on the branch but not the types of commit they were. Using something like this :
# Type queries here, and you will see intelligent autosuggestions
# aware of GitHub's current GraphQL schema, equipped with live
# syntax and validation errors highlighted within the text. We'll
# get you started with a simple query showing your username!
{
repository(owner: "OrgName", name: "RepoName") {
ref(qualifiedName: "main") {
target {
... on Commit {
id
history(first: 100) {
pageInfo {
hasNextPage
}
edges {
node {
messageHeadline
oid
message
author {
name
email
date
}
}
}
}
}
}
}
}
}
If I could just get some information about the commit like if it was force pushed or if it was a squashed commit. Or If I could get a GraphQL that works like git reflog that would be great too. Any suggestions would be nice.