Closed charliezhao closed 2 years ago
Thanks for the bug report @charliezhao! It looks like the arguments aren't getting passed through correctly. Please could you share your GitHub Actions yaml file for how you're using it?
Hi @charliezhao is this the repo you were having problems with? https://github.com/charliezhao/action-sample-cpp
I think the issue is that the yml file is overriding the defaults, so it doesn't pick up the github context for the PR number:
name: clang-tidy-review
# You can be more specific, but it currently only works on pull requests
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: clang-tidy review
# You may pin to the exact commit or the version.
# uses: ZedThree/clang-tidy-review@33e015025bb38c888d54b66bb97ca7c81c259436
uses: ZedThree/clang-tidy-review@v0.4.0
with:
# Authentication token
token: # optional, default is ${{ github.token }}
# Directory containing the compile_commands.json file
build_dir: # optional, default is .
# Version of clang-tidy to use; one of 6.0, 7, 8, 9, 10
clang_tidy_version: # optional, default is 10
# List of checks
clang_tidy_checks: # optional, default is -*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*
# Comma-separated list of files or patterns to include
include: # optional, default is "*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh"
# Comma-separated list of files or patterns to exclude
exclude: # optional, default is
# Comma-separated list of apt packages to install
apt_packages: # optional, default is
# Maximum number of comments to post at once
max_comments: # optional, default is 25
#
pr: # optional, default is ${{ github.event.pull_request.number }}
#
repo: # optional, default is ${{ github.repository }}
Please could you try remove all the arguments:
name: clang-tidy-review
# You can be more specific, but it currently only works on pull requests
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: clang-tidy review
uses: ZedThree/clang-tidy-review@v0.4.0
I'm seeing the same issue, using the default YAML file from your README. In my case the same error appears when I ask the Action to run on pushes, and it gets run during a
Nevermind, I'm silly, the Action only supposed to work on PRs, not on pushes. My bad, sorry.push
. It sort of makes sense that there's no PR number associated with a push, so either we shouldn't pass in the --pr
flag in case of pushes, or handle the instances when the --pr
flag has an empty value.
Run ZedThree/clang-tidy-review@v0.4.0 /usr/bin/docker run --name ff1ccb9d3f9b4dac82059bcdf817b21c_31130d --label 442333 --workdir /github/workspace --rm -e INPUT_TOKEN -e INPUT_BUILD_DIR -e INPUT_CLANG_TIDY_VERSION -e INPUT_CLANG_TIDY_CHECKS -e INPUT_INCLUDE -e INPUT_EXCLUDE -e INPUT_APT_PACKAGES -e INPUT_MAX_COMMENTS -e INPUT_PR -e INPUT_REPO -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_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_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_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/action-sample-cpp/action-sample-cpp":"/github/workspace" 442333:ff1ccb9d3f9b4dac82059bcdf817b21c "--clang_tidy_binary=clang-tidy-" "--token=" "--repo=" "--pr=" "--build_dir=" "--clang_tidy_checks=" "--include " "--exclude " "--apt-packages=" usage: review.py [-h] [--repo REPO] [--pr PR] [--clang_tidy_binary CLANG_TIDY_BINARY] [--build_dir BUILD_DIR] [--clang_tidy_checks CLANG_TIDY_CHECKS] [--include [INCLUDE]] [--exclude [EXCLUDE]] [--apt-packages APT_PACKAGES] [--max-comments MAX_COMMENTS] [--token TOKEN] review.py: error: argument --pr: invalid int value: ''