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

Simplify GitHub Action entrypoint (#1909) #2119

Merged
merged 3 commits into from May 6, 2021
Merged

Simplify GitHub Action entrypoint (#1909) #2119

merged 3 commits into from May 6, 2021

Conversation

ghost
Copy link

@ghost ghost commented Apr 19, 2021

This PR 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.

Any suggestions for improvements are more than welcome. Thanks!

This PR may not require a changelog entry.

@cooperlees cooperlees added the skip news Pull requests that don't need a changelog entry. label Apr 28, 2021
Copy link
Collaborator

@cooperlees cooperlees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this. Looks good to me. Lets merge with the deprecated option and remove that in a few months.

My only question, is there a way we can make CI using black_args indicate deprecate warnings to the users?

@cooperlees cooperlees added the C: integrations Editor plugins and other integrations label Apr 28, 2021
action/entrypoint.sh Outdated Show resolved Hide resolved
@ghost
Copy link
Author

ghost commented Apr 29, 2021

@cooperlees
Yes, we can indicate deprecate warnings to the users: Setting a warning message - GitHub Actions.

Please commit the above suggestion to make this change. Thank you!

This deprecation should be visible in GitHub Action's UI now.

Co-authored-by: Shota Ray Imaki <[email protected]>
@ichard26
Copy link
Collaborator

ichard26 commented May 6, 2021

If no one objects before then, I'll be merging this in 30ish minutes. Cooperlees already approved and his non-binding comment was also resolved. Primer is just failing because this doesn't have the change noting how tox is actually expecting no changes.

@ichard26 ichard26 merged commit 5316836 into psf:master May 6, 2021
@ichard26
Copy link
Collaborator

ichard26 commented May 6, 2021

Thank you @simaki for your contribution! This should help keep this action maintainable and easy to understand which is always nice since not everyone on the core team is great at this kind of stuff (e.g. me!)

Copy link
Author

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ichard26 Hi, could you kindly merge these fixes? I noticed these mistakes by my local run. Sorry about bothering you... Many thanks! (btw continuous testing of GH Actions would be nice but I've got no idea how to do it. seeking idea.)

if [ -n $INPUT_BLACK_ARGS ]; then
echo '::warning::Input `with.black_args` is deprecated. Use `with.options` and `with.src` instead.'
black $INPUT_BLACK_ARGS
exit $?
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fi is missing here...

Suggested change
exit $?
exit $?
fi

# Default (if no args provided).
black_args+=("--check" "--diff")
fi
if [ -n $INPUT_BLACK_ARGS ]; then
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" is necessary to check if $INPUT_BLACK_ARGS is empty.

Suggested change
if [ -n $INPUT_BLACK_ARGS ]; then
if [ -n "$INPUT_BLACK_ARGS" ]; then

@ichard26
Copy link
Collaborator

ichard26 commented May 6, 2021

ichard26 Hi, could you kindly merge these fixes? I noticed these mistakes by my local run. Sorry about bothering you... Many thanks! (btw continuous testing of GH Actions would be nice but I've got no idea how to do it. seeking idea.)

yeah don't worry about, I'm honestly more surprised I didn't catch that error 😞, here's the hotfix: #2202

I got some ideas to test out our Action but they will have to wait till later once I get some time.

@ghost ghost deleted the feature/gh-action branch May 8, 2021 06:48
@Secret158

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: integrations Editor plugins and other integrations skip news Pull requests that don't need a changelog entry.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants