-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Release gh action #1909
Release gh action #1909
Conversation
This commit fixes a bug which caused not all input arguments were forwarder to the black formatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the lint - Rest looks good.
Fuzz: libcst errors parsing it seems - I don't understand what but it can't be caused by this PR:
File "<string>", line 6, in __init__
- So I'll ignore that and merge and look to fix elsewhere.
This PR is hitting #1012 by chance. Also, LibCST? You mean the obviously better blib2to3 :) edit: the LibCST vs blib2to3 thing was a joke, Black is gonna need to retire it soon because the parser change in CPython |
Co-authored-by: Cooper Lees <[email protected]>
Ignoring fuzzer changes we need to look into elsewhere and merging this to unblock the release to market place |
Maybe it would be worth investigating https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runsargs because IMO this is pretty bad UX even it works. Thanks for working on this though! |
@ichard26 Thanks for your comment! Your correct, I also noticed this some weeks ago on another action. I didn't have the time yet to open a new pull request. I think the code can be simplified to: #!/bin/sh
set -e
black_args=(".")
if [ "${INPUT_BLACK_ARGS}" != "" ]; then
black_args+=(${INPUT_BLACK_ARGS})
else
# Default (if no args provided).
black_args+=("--check" "--diff")
fi
sh -c "black . ${black_args[*]}" @ichard26, @cooperlees Let me know what you think. |
This is a kind reminder. @ichard26 @cooperlees Thank you a lot, @rickstaa! I use this action and find it quite useful. By the way, that script may give Also, now that we only have #!/bin/sh -e
args=$INPUT_BLACK_ARGS
if [ -z "$args" ]; then
# Default (If no args provided).
args='. --check --diff'
fi
sh -c "black $args" Could you make a PR, @rickstaa? Or I'll handle it if you are busy. EDIT: Or, we can just set the default value Line 8 in 9eb29a6
Then the script would be even simpler. #!/bin/sh -e
sh -c "black $INPUT_BLACK_ARGS" |
@simaki Thanks a lot for your comment! I this pull request, I did my best also to support the docker #!/bin/sh -e
sh -c "black $INPUT_BLACK_ARGS" If @cooperlees agrees, I think it would be great if you could create a pull request. |
I see no problem with any of this. |
This commit simplifies entrypoint.sh for GitHub Actions by removing duplication of args and black_args (cf. #1909). The reason why #1909 uses the input id black_args is to avoid an overlap with args, but this naming seems redundant. So let me suggest option and src, which are consistent with CLI. Backward compatibility is guaranteed; Users can still use black_args as well. Commit history pre-merge: * Simplify GitHub Action entrypoint (#1909) * Fix prettier * Emit a warning message when `black_args` is used This deprecation should be visible in GitHub Action's UI now. Co-authored-by: Shota Ray Imaki <[email protected]> Co-authored-by: Richard Si <[email protected]>
Makes some changes to the gh-action such that it can be released to the marketplace. I could be wrong, but to my knowledge users do not have access to the
args
docker argument when using the action. I, therefore, added ablack_args
input argument.