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 skip steps #180

Merged
merged 1 commit into from
Oct 14, 2021
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
6 changes: 6 additions & 0 deletions .github/actions/draft-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ inputs:
since_last_stable:
description: Use PRs with activity since the last stable git tag
required: false
steps_to_skip:
description: comma-separated list of steps to steps_to_skip
required: false

outputs:
release_url:
description: "The html URL of the draft GitHub release"
value: ${{ steps.draft-release.outputs.release_url }}

runs:
using: "composite"
steps:
Expand All @@ -50,6 +55,7 @@ runs:
export RH_DRY_RUN=${{ inputs.dry_run }}
export RH_SINCE=${{ inputs.since }}
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}

# Install Jupyter Releaser from git
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
Expand Down
6 changes: 6 additions & 0 deletions .github/actions/publish-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ inputs:
description: "If set, do not push permanent changes"
default: "false"
required: false
steps_to_skip:
description: comma-separated list of steps to steps_to_skip
required: false

outputs:
release_url:
description: "The html URL of the GitHub release"
value: ${{ steps.publish-release.outputs.release_url }}
pr_url:
description: "The html URL of the forwardport PR if applicable"
value: ${{ steps.publish-release.outputs.pr_url }}

runs:
using: "composite"
steps:
Expand All @@ -30,6 +35,7 @@ runs:
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
export RH_DRY_RUN=${{ inputs.dry_run }}
export release_url=${{ inputs.release_url }}
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}

# Install Jupyter Releaser from git
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v1
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
since_last_stable:
description: Use PRs with activity since the last stable git tag
required: false
steps_to_skip:
description: comma-separated list of steps to steps_to_skip
required: false
jobs:
release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -57,6 +60,7 @@ jobs:
post_version_spec: ${{ github.event.inputs.post_version_spec }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.inputs.since_last_stable }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
- name: "** Next Step **"
run: |
echo "Run the "Publish Release" Workflow with Release Url:"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/full-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ on:
since_last_stable:
description: Use PRs with activity since the last stable git tag
required: false
steps_to_skip:
description: comma-separated list of steps to steps_to_skip
required: false

jobs:
release:
Expand Down Expand Up @@ -58,6 +61,7 @@ jobs:
post_version_spec: ${{ github.event.inputs.post_version_spec }}
since: ${{ github.event.inputs.since }}
since_last_stable: ${{ github.event.intputs.since_last_stable }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}

- name: Publish Release
id: publish-release
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
release_url:
description: "The URL of the draft GitHub release"
required: true
steps_to_skip:
description: comma-separated list of steps to steps_to_skip
required: false
jobs:
publish_release:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -38,6 +41,7 @@ jobs:
with:
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
release_url: ${{ github.event.inputs.release_url }}
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
- name: "** Next Step **"
run: |
echo "Verify the final release"
Expand Down
5 changes: 5 additions & 0 deletions docs/source/reference/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ Create a new manual PR to fix the PR and re-orient the changelog entry markers.

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
pick up the new PR.

## What happens if one of my steps is failing but I want to force a release?

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
workflow's "steps_to_skip" input option.
3 changes: 3 additions & 0 deletions jupyter_releaser/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ def invoke(self, ctx):
hooks = config.get("hooks", {})
options = config.get("options", {})
skip = config.get("skip", [])

if "--force" in ctx.args:
skip = []
ctx.args.remove("--force")

skip += os.environ.get("RH_STEPS_TO_SKIP", "").split(",")

# Print a separation header
util.log(f'\n\n{"-" * 50}')
util.log(cmd_name)
Expand Down
15 changes: 14 additions & 1 deletion jupyter_releaser/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def test_draft_changelog_full(py_package, mocker, runner, open_mock, git_prep):
open_mock.assert_called_once()


def test_draft_changelog_skip(py_package, mocker, runner, open_mock, git_prep):
def test_draft_changelog_skip_config(py_package, mocker, runner, open_mock, git_prep):
mock_changelog_entry(py_package, runner, mocker)

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


def test_draft_changelog_skip_environ(py_package, mocker, runner, open_mock, git_prep):
mock_changelog_entry(py_package, runner, mocker)

config_path = Path(util.CHECKOUT_NAME) / util.JUPYTER_RELEASER_CONFIG
config = util.toml.loads(config_path.read_text(encoding="utf-8"))
os.environ["RH_STEPS_TO_SKIP"] = "draft-changelog,other-fake-step"
config_path.write_text(util.toml.dumps(config), encoding="utf-8")

runner(["draft-changelog", "--version-spec", VERSION_SPEC, "--since", "foo"])
open_mock.assert_not_called()
del os.environ["RH_STEPS_TO_SKIP"]


def test_draft_changelog_dry_run(npm_package, mocker, runner, git_prep):
mock_changelog_entry(npm_package, runner, mocker)
os.environ["RH_SINCE_LAST_STABLE"] = "true"
Expand Down