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

Expect the protected key to always exist #145

Merged
merged 1 commit into from
Sep 28, 2022

Conversation

CasperWA
Copy link
Owner

Closes #144

This is to avoid having to determine the user's role to infer whether a branch is protected or not.

This is to avoid having to determine the user's role to infer whether a
branch is protected or not.
@@ -188,17 +187,14 @@ def protected_branch(branch: str) -> str:
"""
url = f"/repos/{os.getenv('GITHUB_REPOSITORY', '')}/branches/{branch}"
response: "Dict[str, Any]" = api_request(url) # type: ignore[assignment]
if response.get("protected", False):
if check_user_role("admin"):
Copy link

@Shahaed Shahaed Sep 28, 2022

Choose a reason for hiding this comment

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

This should work. I only removed this line and this action worked with the Github App token.

Then I found out docker actions don't run on macos runners where I needed this action to do our iOS builds. So I had to rewrite this entire action in javascript 🙃. FML, but I used this action as a guide so it was fairly smooth. Thanks!

Copy link
Owner Author

Choose a reason for hiding this comment

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

I have wanted to do this for a while; updating it to JS from Docker. If you want to contribute it back feel free, otherwise it's fair to release under a fork as a new action as well 👍

@CasperWA CasperWA merged commit 321ea73 into main Sep 28, 2022
@CasperWA CasperWA deleted the cwa/close-144-allow-app-tokens branch September 28, 2022 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow using Github App Token
2 participants