Skip to content

Commit 391fbc4

Browse files
author
Steven Silvester
authored
Merge pull request #180 from blink1073/allow-skip-steps
Add ability to skip steps
2 parents c16943d + 46eff76 commit 391fbc4

File tree

8 files changed

+46
-1
lines changed

8 files changed

+46
-1
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ inputs:
2626
since_last_stable:
2727
description: Use PRs with activity since the last stable git tag
2828
required: false
29+
steps_to_skip:
30+
description: comma-separated list of steps to steps_to_skip
31+
required: false
32+
2933
outputs:
3034
release_url:
3135
description: "The html URL of the draft GitHub release"
3236
value: ${{ steps.draft-release.outputs.release_url }}
37+
3338
runs:
3439
using: "composite"
3540
steps:
@@ -50,6 +55,7 @@ runs:
5055
export RH_DRY_RUN=${{ inputs.dry_run }}
5156
export RH_SINCE=${{ inputs.since }}
5257
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
58+
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
5359
5460
# Install Jupyter Releaser from git
5561
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ inputs:
1111
description: "If set, do not push permanent changes"
1212
default: "false"
1313
required: false
14+
steps_to_skip:
15+
description: comma-separated list of steps to steps_to_skip
16+
required: false
17+
1418
outputs:
1519
release_url:
1620
description: "The html URL of the GitHub release"
1721
value: ${{ steps.publish-release.outputs.release_url }}
1822
pr_url:
1923
description: "The html URL of the forwardport PR if applicable"
2024
value: ${{ steps.publish-release.outputs.pr_url }}
25+
2126
runs:
2227
using: "composite"
2328
steps:
@@ -30,6 +35,7 @@ runs:
3035
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
3136
export RH_DRY_RUN=${{ inputs.dry_run }}
3237
export release_url=${{ inputs.release_url }}
38+
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
3339
3440
# Install Jupyter Releaser from git
3541
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1

.github/workflows/draft-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
since_last_stable:
2121
description: Use PRs with activity since the last stable git tag
2222
required: false
23+
steps_to_skip:
24+
description: comma-separated list of steps to steps_to_skip
25+
required: false
2326
jobs:
2427
release:
2528
runs-on: ubuntu-latest
@@ -57,6 +60,7 @@ jobs:
5760
post_version_spec: ${{ github.event.inputs.post_version_spec }}
5861
since: ${{ github.event.inputs.since }}
5962
since_last_stable: ${{ github.event.inputs.since_last_stable }}
63+
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
6064
- name: "** Next Step **"
6165
run: |
6266
echo "Run the "Publish Release" Workflow with Release Url:"

.github/workflows/full-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
since_last_stable:
2121
description: Use PRs with activity since the last stable git tag
2222
required: false
23+
steps_to_skip:
24+
description: comma-separated list of steps to steps_to_skip
25+
required: false
2326

2427
jobs:
2528
release:
@@ -58,6 +61,7 @@ jobs:
5861
post_version_spec: ${{ github.event.inputs.post_version_spec }}
5962
since: ${{ github.event.inputs.since }}
6063
since_last_stable: ${{ github.event.intputs.since_last_stable }}
64+
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
6165

6266
- name: Publish Release
6367
id: publish-release

.github/workflows/publish-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
release_url:
66
description: "The URL of the draft GitHub release"
77
required: true
8+
steps_to_skip:
9+
description: comma-separated list of steps to steps_to_skip
10+
required: false
811
jobs:
912
publish_release:
1013
runs-on: ubuntu-latest
@@ -38,6 +41,7 @@ jobs:
3841
with:
3942
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
4043
release_url: ${{ github.event.inputs.release_url }}
44+
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
4145
- name: "** Next Step **"
4246
run: |
4347
echo "Verify the final release"

docs/source/reference/faq.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ Create a new manual PR to fix the PR and re-orient the changelog entry markers.
88

99
The release will fail to push commits because it will not be up to date. Delete the pushed tags and re-start with "Draft Changelog" to
1010
pick up the new PR.
11+
12+
## What happens if one of my steps is failing but I want to force a release?
13+
14+
This could happen for example if you need to override PRs to include in the changelog. In that case you would pass "check-changlog" to the
15+
workflow's "steps_to_skip" input option.

jupyter_releaser/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,13 @@ def invoke(self, ctx):
5151
hooks = config.get("hooks", {})
5252
options = config.get("options", {})
5353
skip = config.get("skip", [])
54+
5455
if "--force" in ctx.args:
5556
skip = []
5657
ctx.args.remove("--force")
5758

59+
skip += os.environ.get("RH_STEPS_TO_SKIP", "").split(",")
60+
5861
# Print a separation header
5962
util.log(f'\n\n{"-" * 50}')
6063
util.log(cmd_name)

jupyter_releaser/tests/test_cli.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def test_draft_changelog_full(py_package, mocker, runner, open_mock, git_prep):
311311
open_mock.assert_called_once()
312312

313313

314-
def test_draft_changelog_skip(py_package, mocker, runner, open_mock, git_prep):
314+
def test_draft_changelog_skip_config(py_package, mocker, runner, open_mock, git_prep):
315315
mock_changelog_entry(py_package, runner, mocker)
316316

317317
config_path = Path(util.CHECKOUT_NAME) / util.JUPYTER_RELEASER_CONFIG
@@ -323,6 +323,19 @@ def test_draft_changelog_skip(py_package, mocker, runner, open_mock, git_prep):
323323
open_mock.assert_not_called()
324324

325325

326+
def test_draft_changelog_skip_environ(py_package, mocker, runner, open_mock, git_prep):
327+
mock_changelog_entry(py_package, runner, mocker)
328+
329+
config_path = Path(util.CHECKOUT_NAME) / util.JUPYTER_RELEASER_CONFIG
330+
config = util.toml.loads(config_path.read_text(encoding="utf-8"))
331+
os.environ["RH_STEPS_TO_SKIP"] = "draft-changelog,other-fake-step"
332+
config_path.write_text(util.toml.dumps(config), encoding="utf-8")
333+
334+
runner(["draft-changelog", "--version-spec", VERSION_SPEC, "--since", "foo"])
335+
open_mock.assert_not_called()
336+
del os.environ["RH_STEPS_TO_SKIP"]
337+
338+
326339
def test_draft_changelog_dry_run(npm_package, mocker, runner, git_prep):
327340
mock_changelog_entry(npm_package, runner, mocker)
328341
os.environ["RH_SINCE_LAST_STABLE"] = "true"

0 commit comments

Comments
 (0)