-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: using compareCommits for push event commit query #801
Conversation
Sync with wagoid/commitlint
…efore to after event
@wagoid I tested this locally with something like the following and it all seemed to work out. Let me know what you think! const github = require('@actions/github')
async function run() {
const octokit = github.getOctokit(process.env.GITHUB_TOKEN)
// You can also pass in additional options as a second parameter to getOctokit
// const octokit = github.getOctokit(myToken, {userAgent: "MyActionVersion1"});
const { data: compareCommits } = await octokit.rest.repos.compareCommits({
owner: 'wagoid',
repo: 'commitlint-github-action',
base: 'baa1b236f990293a1b2d94c19e41c2313a85e749',
head: '0de15449e923d75a908bd7ab4e89c4e69af9ab1f',
per_page: 100,
})
console.log(compareCommits.commits)
}
run() |
hey @wagoid wanted to know if you had any questions or issues with this PR. This would help us out a lot and I'd rather not use our fork of this action if possible. |
Thanks @Brian-Triplett! Sorry for the delay, I could only have a look at this now.
In this case, I believe we should fallback to the commits coming from |
In this PR you can better see this issue happening only in the first push: #803 |
@wagoid just pushed up the change to handle the first push scenario. Let me know what you think! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! LGTM
To actually resolve #752.
This logic uses the
before
andafter
shas in the push event with the compareCommits REST resource in OctoKit to get a list of commits between two shas. This should accomplish getting the commits included from an incoming push to a givenref