rtCamp / action-phpcs-code-review

Github Action to perform automated code review on pull requests
https://github.com/rtCamp/github-actions-library
MIT License
101 stars 26 forks source link

branch pull request commit ID looks wrong #13

Closed AricStewart closed 4 years ago

AricStewart commented 4 years ago

Hello, Just started to try to use this (awesome really looking forward to it) however it is not working for my repo at present.

I appear to be getting this message at then end of my scan:

[ 2019-10-15T08:31:35+05:30 -- 0 ] Skipping scanning entirely, as the commit is not a part of any Pull-Request; []

Sure enough the commit ID for the patch in question is c9c2b2bdf615ecb3a0383b008737a731b9219df7 but the log appears to be trying for --commit=89ea04233704fc476d3dafb7e07fc966fbb9bfef I have no idea where it is getting that id.

Do I have my repository setup wrong or is this an issue I am running into.

https://github.com/AricStewart/ffxiv_craft/pull/5/checks?check_run_id=260086193

mrrobot47 commented 4 years ago

Hi @AricStewart, Thanks for reporting this issue. I have checked and tried re-creating this scenario. It is occurring for me as well.

After checking, I found out that this issue started occurring post an update in GitHub actions. I will be working on a fix for this and will mostly create a PR with more details tomorrow.

AricStewart commented 4 years ago

Thanks for the update!

mrrobot47 commented 4 years ago

This issue was not present previously. But after introduction of GitHub actions checkout action (required to get repo content in actions run), the issue started occurring because the checkout action does not checkout to the PR branch, instead it checkouts to a new ref similar to: refs/pull/PR_NUMBER/merge. Which has an additional commit linked to it. For more info on how this occurs read here.

Thus, the phpcs action run could not identify that commit being linked with any latest commits from open PRs in the repo. Leading to skipping every time the action was run.

I have implemented a fix in #14 to checkout the actions workspace to the latest commit of PR. Which will solve this issue.