Skip to content
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

Add inputs #4

Merged
merged 14 commits into from
Aug 18, 2021
Merged

Add inputs #4

merged 14 commits into from
Aug 18, 2021

Conversation

2bndy5
Copy link
Collaborator

@2bndy5 2bndy5 commented Aug 18, 2021

resolves #3
This adds 2 new inputs to the action:

  1. style can be set to any of the values that clang-format accepts.
  2. extensions a comma seperated list of file extensions for which to focus on. I added this one because I noticed the action was running clang-tidy/format on all changed files in the PR (which obviously resulted in more annoying failures and longer bot comments).

I can explain how the input args get passed to the run_checks.sh if needed.

I have also updated the Readme about the user inputs and required GH secrets token


demo now lives here

I added a basic workflow using the action to test on a drafted PR since push events always fail with this action.

@shenxianpeng
Copy link
Collaborator

Hi Brendan, your PR looks amazing! I tried to run act pull_request locally, it seems success, I guess you should have tested it, so I am happy to merge.

I can explain how the input args get passed to the run_checks.sh if needed.

I would love to learn from you how to pass parameters to run_checks.sh, thank you.

@shenxianpeng shenxianpeng self-requested a review August 18, 2021 15:22
@shenxianpeng shenxianpeng merged commit 180d0c2 into cpp-linter:master Aug 18, 2021
@2bndy5
Copy link
Collaborator Author

2bndy5 commented Aug 18, 2021

The secret sauce is here in actions.yml:

https://github.com/shenxianpeng/cpp-linter-action/blob/180d0c2ee05e2fb21f3f237078471c130344c46f/action.yml#L19-L21

According to GH docs the args list replaces the Dockerfile's CMD option. Meaning, all args are basically strings passed to the Dockerfile's ENTRYPOINT executable as CLI args. From there I just used bash-script to capture them and then do something with them.

https://github.com/shenxianpeng/cpp-linter-action/blob/180d0c2ee05e2fb21f3f237078471c130344c46f/runchecks.sh#L8-L9

You can probably better understand now why I had to make modifications to the Dockerfile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

open to contributions?
2 participants