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 ability to disable admin user check via flag #559

Merged
merged 5 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/actions/check-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ inputs:
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false
admin_check:
description: "Check if the user is a repo admin"
required: false
default: "true"
shell:
description: "The shell being used for the action steps"
required: false
Expand All @@ -31,6 +35,7 @@ runs:
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_VERSION_SPEC=${{ inputs.version_spec }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
python -m jupyter_releaser.actions.prep_release

- id: populate-release
Expand All @@ -40,6 +45,7 @@ runs:
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_RELEASE_URL=${{ steps.prep-release.outputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
export YARN_UNSAFE_HTTP_WHITELIST=0.0.0.0
python -m jupyter_releaser.actions.populate_release

Expand All @@ -50,4 +56,5 @@ runs:
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_RELEASE_URL=${{ steps.populate-release.outputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
python -m jupyter_releaser.actions.finalize_release
5 changes: 5 additions & 0 deletions .github/actions/finalize-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false
admin_check:
description: "Check if the user is a repo admin"
required: false
default: "true"
shell:
description: "The shell being used for the action steps"
required: false
Expand Down Expand Up @@ -52,6 +56,7 @@ runs:
export RH_RELEASE_URL=${{ inputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_BRANCH=${{ inputs.branch }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
python -m jupyter_releaser.actions.finalize_release

- if: ${{ success() }}
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/populate-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ inputs:
steps_to_skip:
description: "Comma separated list of steps to skip"
required: false
admin_check:
description: "Check if the user is a repo admin"
required: false
default: "true"
shell:
description: "The shell being used for the action steps"
required: false
Expand Down Expand Up @@ -49,6 +53,7 @@ runs:
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
export RH_RELEASE_URL=${{ inputs.release_url }}
export RH_BRANCH=${{ inputs.branch }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
python -m jupyter_releaser.actions.populate_release

- if: ${{ failure() }}
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/prep-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ inputs:
silent:
description: "Set a placeholder in the changelog and don't publish the release."
required: false
type: boolean
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming this was an unintended removal?

Copy link
Contributor Author

@ElioDiNino ElioDiNino Mar 2, 2024

Choose a reason for hiding this comment

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

Nah that was on purpose. Types aren't supported for action inputs (reference here) and the GitHub actions extension in VS Code was complaining about it

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see, thank you!

since:
description: "Use PRs with activity since this date or git reference"
required: false
since_last_stable:
description: "Use PRs with activity since the last stable git tag"
required: false
admin_check:
description: "Check if the user is a repo admin"
required: false
default: "true"
shell:
description: "The shell being used for the action steps"
required: false
Expand Down Expand Up @@ -63,6 +66,7 @@ runs:
export RH_SILENT=${{ inputs.silent }}
export RH_SINCE=${{ inputs.since }}
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}

python -m jupyter_releaser.actions.prep_release

Expand Down
5 changes: 5 additions & 0 deletions .github/actions/publish-changelog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
description: "If set, do not make a PR"
default: "false"
required: false
admin_check:
description: "Check if the user is a repo admin"
required: false
default: "true"
shell:
description: "The shell being used for the action steps"
required: false
Expand Down Expand Up @@ -41,6 +45,7 @@ runs:
export RH_BRANCH=${{ inputs.branch }}
fi
export RH_DRY_RUN=${{ inputs.dry_run }}
export RH_ADMIN_CHECK=${{ inputs.admin_check }}

python -m jupyter_releaser.actions.publish_changelog

Expand Down
2 changes: 1 addition & 1 deletion jupyter_releaser/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ def prepare_environment(fetch_draft_release=True):
gh = get_gh_object(dry_run=dry_run, owner=owner, repo=repo_name, token=auth)

# Ensure the user is an admin.
if not dry_run:
if os.environ.get("RH_ADMIN_CHECK", "true").lower() == "true" and not dry_run:
user = os.environ["GITHUB_ACTOR"]
log(f"Getting permission level for {user}")
try:
Expand Down
Loading