rtCamp / action-phpcs-code-review

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

Can not use local Git repository, seems not to be in sync with current commit or does not exist #53

Open akashdhawade2005 opened 2 years ago

akashdhawade2005 commented 2 years ago

Following is the output I get:

Run rtCamp/action-phpcs-code-review@v2
  with:
    args: WordPressVIPMinimum, WordPress-VIP-Go
  env:
    GH_BOT_TOKEN: ***
    SKIP_FOLDERS: tests,.github
    PHPCS_SNIFFS_EXCLUDE: WordPress.Files.FileName
/usr/bin/docker run --name ghcriortcampactionphpcscodereviewv210_0b4926 --label 7db2d7 --workdir /github/workspace --rm -e GH_BOT_TOKEN -e SKIP_FOLDERS -e PHPCS_SNIFFS_EXCLUDE -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/guest-post/guest-post":"/github/workspace" ghcr.io/rtcamp/action-phpcs-code-review:v2.1.0 WordPressVIPMinimum, WordPress-VIP-Go
COMMIT ID: null
 _______________________________________
/ Running with the flag                 \
\ --phpcs-standard=WordPressVIPMinimum, /
 ---------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
Running the following command
/home/rtbot/vip-go-ci-tools/vip-go-ci/vip-go-ci.php   --phpcs-skip-folders-in-repo-options-file=true   --lint-skip-folders-in-repo-options-file=true   --repo-options=true   --phpcs=true   --repo-owner=akashdhawade2005   --repo-name=guest-post   --commit=null   --token=$GH_BOT_TOKEN   --local-git-repo=/home/rtbot/github-workspace   --phpcs-path='/home/rtbot/vip-go-ci-tools/phpcs/bin/phpcs'   --phpcs-standard=WordPressVIPMinimum,   --phpcs-sniffs-exclude='WordPress.Files.FileName'   --skip-folders='tests,.github'   --lint=true   --informational-url='https://github.com/rtCamp/action-phpcs-code-review/'
[ 2022-02-01T20:00:25+05:30 -- 0 ]  Getting git version...; {
    "cmd": "git '--version' 2>&1"
}
[ 2022-02-01T20:00:25+05:30 -- 0 ]  Initializing...; {
    "debug_info": {
        "vipgoci_version": "1.0.7",
        "php_version": "7.4.21",
        "hostname": "b3644fc4c257",
        "php_uname": "Linux b3644fc4c257 5.11.0-1027-azure #30~20.04.1-Ubuntu SMP Wed Jan 12 20:56:50 UTC 2022 x86_64",
        "git_version": "2.17.1"
    }
}
[ 2022-02-01T20:00:25+05:30 -- 0 ]  Attempting to read configuration from environmental variables; {
    "env-options": [],
    "options-recognized": [
        "help",
        "debug-level:",
        "max-exec-time:",
        "enforce-https-urls:",
        "skip-draft-prs:",
        "branches-ignore:",
        "local-git-repo:",
        "env-options:",
        "repo-options:",
        "repo-options-allowed:",
        "repo-owner:",
        "repo-name:",
        "commit:",
        "token:",
        "lint:",
        "lint-skip-folders:",
        "lint-skip-folders-in-repo-options-file:",
        "php-path:",
        "phpcs:",
        "phpcs-path:",
        "phpcs-standard:",
        "phpcs-severity:",
        "phpcs-sniffs-include:",
        "phpcs-sniffs-exclude:",
        "phpcs-runtime-set:",
        "phpcs-skip-scanning-via-labels-allowed:",
        "phpcs-skip-folders:",
        "phpcs-skip-folders-in-repo-options-file:",
        "output:",
        "svg-checks:",
        "svg-scanner-path:",
        "autoapprove:",
        "autoapprove-filetypes:",
        "autoapprove-php-nonfunctional-changes:",
        "autoapprove-label:",
        "hashes-api:",
        "hashes-api-url:",
        "hashes-oauth-token:",
        "hashes-oauth-token-secret:",
        "hashes-oauth-consumer-key:",
        "hashes-oauth-consumer-secret:",
        "review-comments-sort:",
        "review-comments-max:",
        "review-comments-total-max:",
        "review-comments-ignore:",
        "review-comments-include-severity:",
        "dismiss-stale-reviews:",
        "dismissed-reviews-repost-comments:",
        "dismissed-reviews-exclude-reviews-from-team:",
        "informational-msg:",
        "post-generic-pr-support-comments:",
        "post-generic-pr-support-comments-on-drafts:",
        "post-generic-pr-support-comments-string:",
        "post-generic-pr-support-comments-skip-if-label-exists:",
        "post-generic-pr-support-comments-branches:",
        "post-generic-pr-support-comments-repo-meta-match:",
        "set-support-level-label:",
        "set-support-level-label-prefix:",
        "set-support-level-field:",
        "repo-meta-api-base-url:",
        "repo-meta-api-user-id:",
        "repo-meta-api-access-token:",
        "irc-api-url:",
        "irc-api-token:",
        "irc-api-bot:",
        "irc-api-room:",
        "pixel-api-url:",
        "pixel-api-groupprefix:"
    ]
}
[ 2022-02-01T20:00:25+05:30 -- 0 ]  Read and set options from environment; {
    "options_configured_keys": []
}
[ 2022-02-01T20:00:25+05:30 -- 0 ]  Can not use local Git repository, seems not to be in sync with current commit or does not exist; {
    "commit_id": "null",
    "local_git_repo": "\/home\/rtbot\/github-workspace",
    "local_git_repo_head": "83512cb7d22ed2030381fccc4bf464cc8ca593d7"
}

Any idea what's wrong?

akashdhawade2005 commented 2 years ago

I believe the issue is because of the null value in COMMIT ID.

tdlm commented 2 years ago

Having same issue. Anyone fix it?

ghost commented 2 years ago

Same problem here... It worked fine like 3-4 months ago Commit ID is not null on my side but i have the same output: Can not use local Git repository, seems not to be in sync with current commit or does not exist;

aaronware commented 2 years ago

This might be due to referencing the action incorrectly. I had the error happen when I was accidentally having the action fire on push to main however the actions steps were referencing ref: ${{ github.event.pull_request.head.sha }} based on the default examples. When I switched that up to not hook into the on push event it resolved my issue