Skip to content

Commit 58a343c

Browse files
authored
Add ability to disable admin user check via flag (#559)
* feat: add RH_ADMIN_CHECK flag * fix: correct env variable parsing and comparison * fix: don't add to cli options * ci: modify actions to add admin check input * fix: properly default to true
1 parent f26f919 commit 58a343c

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

.github/actions/check-release/action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
steps_to_skip:
1212
description: "Comma separated list of steps to skip"
1313
required: false
14+
admin_check:
15+
description: "Check if the user is a repo admin"
16+
required: false
17+
default: "true"
1418
shell:
1519
description: "The shell being used for the action steps"
1620
required: false
@@ -31,6 +35,7 @@ runs:
3135
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
3236
export RH_VERSION_SPEC=${{ inputs.version_spec }}
3337
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
38+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
3439
python -m jupyter_releaser.actions.prep_release
3540
3641
- id: populate-release
@@ -40,6 +45,7 @@ runs:
4045
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
4146
export RH_RELEASE_URL=${{ steps.prep-release.outputs.release_url }}
4247
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
48+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
4349
export YARN_UNSAFE_HTTP_WHITELIST=0.0.0.0
4450
python -m jupyter_releaser.actions.populate_release
4551
@@ -50,4 +56,5 @@ runs:
5056
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
5157
export RH_RELEASE_URL=${{ steps.populate-release.outputs.release_url }}
5258
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
59+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
5360
python -m jupyter_releaser.actions.finalize_release

.github/actions/finalize-release/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ inputs:
2020
steps_to_skip:
2121
description: "Comma separated list of steps to skip"
2222
required: false
23+
admin_check:
24+
description: "Check if the user is a repo admin"
25+
required: false
26+
default: "true"
2327
shell:
2428
description: "The shell being used for the action steps"
2529
required: false
@@ -52,6 +56,7 @@ runs:
5256
export RH_RELEASE_URL=${{ inputs.release_url }}
5357
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
5458
export RH_BRANCH=${{ inputs.branch }}
59+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
5560
python -m jupyter_releaser.actions.finalize_release
5661
5762
- if: ${{ success() }}

.github/actions/populate-release/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ inputs:
2020
steps_to_skip:
2121
description: "Comma separated list of steps to skip"
2222
required: false
23+
admin_check:
24+
description: "Check if the user is a repo admin"
25+
required: false
26+
default: "true"
2327
shell:
2428
description: "The shell being used for the action steps"
2529
required: false
@@ -49,6 +53,7 @@ runs:
4953
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
5054
export RH_RELEASE_URL=${{ inputs.release_url }}
5155
export RH_BRANCH=${{ inputs.branch }}
56+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
5257
python -m jupyter_releaser.actions.populate_release
5358
5459
- if: ${{ failure() }}

.github/actions/prep-release/action.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ inputs:
2424
silent:
2525
description: "Set a placeholder in the changelog and don't publish the release."
2626
required: false
27-
type: boolean
2827
since:
2928
description: "Use PRs with activity since this date or git reference"
3029
required: false
3130
since_last_stable:
3231
description: "Use PRs with activity since the last stable git tag"
3332
required: false
33+
admin_check:
34+
description: "Check if the user is a repo admin"
35+
required: false
36+
default: "true"
3437
shell:
3538
description: "The shell being used for the action steps"
3639
required: false
@@ -63,6 +66,7 @@ runs:
6366
export RH_SILENT=${{ inputs.silent }}
6467
export RH_SINCE=${{ inputs.since }}
6568
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
69+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
6670
6771
python -m jupyter_releaser.actions.prep_release
6872

.github/actions/publish-changelog/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ inputs:
1414
description: "If set, do not make a PR"
1515
default: "false"
1616
required: false
17+
admin_check:
18+
description: "Check if the user is a repo admin"
19+
required: false
20+
default: "true"
1721
shell:
1822
description: "The shell being used for the action steps"
1923
required: false
@@ -41,6 +45,7 @@ runs:
4145
export RH_BRANCH=${{ inputs.branch }}
4246
fi
4347
export RH_DRY_RUN=${{ inputs.dry_run }}
48+
export RH_ADMIN_CHECK=${{ inputs.admin_check }}
4449
4550
python -m jupyter_releaser.actions.publish_changelog
4651

jupyter_releaser/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ def prepare_environment(fetch_draft_release=True):
603603
gh = get_gh_object(dry_run=dry_run, owner=owner, repo=repo_name, token=auth)
604604

605605
# Ensure the user is an admin.
606-
if not dry_run:
606+
if os.environ.get("RH_ADMIN_CHECK", "true").lower() == "true" and not dry_run:
607607
user = os.environ["GITHUB_ACTOR"]
608608
log(f"Getting permission level for {user}")
609609
try:

0 commit comments

Comments
 (0)