Open rishson opened 8 years ago
Then it should work out how to get the hash ranges for the current push:
TRAVIS_COMMIT
CI_COMMIT_ID
GIT_COMMIT
CIRCLECI
How to get versus
if we only have the commit id of the checkout?
Codeship and Travis get the last 50 commits so could work out for Travis using TRAVIS_COMMIT_RANGES
providing the push < 50 commits (so long as the push is > 1 commit )
@timruffles what to do on travis if you want the current pull request analysed. How would you specify you want to only check lines modified by the PR?
Add --mine
option to run
that on non-ci, just analyses modified lines, but on ci, will do the following:
sidekick run --ci --mine
and if we find --mine
work out the commit before the first commit in the TRAVIS_COMMIT_RANGES? Then effectively do sidekick run --versus
with this commit id?
or use github_api: list_pull_request_files
Just some pseudocode for my own thinking:
if ci and is pull_request (TRAVIS_PULL_REQUEST !== false) //is pullrequest ID
git:list_pull_request_files for TRAVIS_REPO_SLUG:TRAVIS_PULL_REQUEST
get modified lines in each file using git-helpers
run analysis on pr files
report only where issues fall on modified lines
I like --mine - or --only-changed? As you might not be in the mindset of "it'll analyse my code"
On Mon, Mar 28, 2016 at 4:36 PM, Andy Richardson notifications@github.com wrote:
Just some pseudocode for my own thinking:
if ci and is pull_request (TRAVIS_PULL_REQUEST !== false) //is pullrequest ID git:list_pull_request_files for TRAVIS_REPO_SLUG:TRAVIS_PULL_REQUEST get modified lines in each file using git-helpers run analysis on pr files report only where issues fall on modified lines
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/sidekickcode/tracker/issues/222#issuecomment-202443091
To enable on Jenkins, we could do:
Array<PR_number> GET /repos/:owner/:repo/pulls
then for each PR
Array<Commit_details> GET /repos/:owner/:repo/pulls/:number/commits
if any commit shas match the CI commit sha, then
Array<Files> GET /repos/:owner/:repo/pulls/:number/files
for the matching PR.
I think that initially, Jenkins support could be done with the github-pr-builder-plugin. It gives us the PR number and PR target branch (which we could parse the repo slug from I guess). We would still have the gh auth issues though. Is it reasonable to get the user to store a sidekick gh auth token in a travis env var?
run
isCI
should parseenv
and return:{ciServer: [travis|codeship|jenkins|unknown]}
For travis - look for:
TRAVIS=true
For codeship - look for:CI_NAME=codeship
For jenkins - look for:JENKINS_URL
For circle - look for:CIRCLECI