Skip to content

Commit 7e4ad4b

Browse files
authored
More workflow cleanup (#380)
1 parent e8dd7b6 commit 7e4ad4b

File tree

9 files changed

+41
-3
lines changed

9 files changed

+41
-3
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ inputs:
77
target:
88
description: "The owner/repo GitHub target"
99
required: false
10+
branch:
11+
description: "The target branch"
12+
required: false
1013
release_url:
1114
description: "The full url to the GitHub release page"
1215
required: false
@@ -43,4 +46,5 @@ runs:
4346
export RH_DRY_RUN=${{ inputs.dry_run }}
4447
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
4548
export RH_RELEASE_URL=${{ inputs.release_url }}
49+
export RH_BRANCH=${{ inputs.branch }}
4650
python -m jupyter_releaser.actions.draft_release

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ inputs:
77
target:
88
description: "The owner/repo GitHub target"
99
required: false
10+
branch:
11+
description: "The target branch"
12+
required: false
1013
release_url:
1114
description: "The full url to the GitHub release page"
1215
required: false
@@ -45,4 +48,5 @@ runs:
4548
export RH_DRY_RUN=${{ inputs.dry_run }}
4649
export RH_RELEASE_URL=${{ inputs.release_url }}
4750
export RH_STEPS_TO_SKIP=${{ inputs.steps_to_skip }}
51+
export RH_BRANCH=${{ inputs.branch }}
4852
python -m jupyter_releaser.actions.publish_release

.github/workflows/draft-changelog.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ on:
2121
since_last_stable:
2222
description: "Use PRs with activity since the last stable git tag"
2323
required: false
24+
type: boolean
2425
jobs:
2526
draft_changelog:
2627
runs-on: ubuntu-latest

.github/workflows/draft-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
target:
66
description: "The owner/repo GitHub target"
77
required: false
8+
branch:
9+
description: "The target branch"
10+
required: false
811
release_url:
912
description: "The URL of the draft GitHub release"
1013
required: false
@@ -34,6 +37,7 @@ jobs:
3437
target: ${{ github.event.inputs.target }}
3538
release_url: ${{ github.event.inputs.release_url }}
3639
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
40+
branch: ${{ github.event.inputs.branch }}
3741

3842
- name: "** Next Step **"
3943
run: |

.github/workflows/full-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
target:
66
description: "The owner/repo GitHub target"
77
required: false
8+
branch:
9+
description: "The target branch"
10+
required: false
811
release_url:
912
description: "The URL of the draft GitHub release"
1013
required: false
@@ -32,6 +35,7 @@ jobs:
3235
with:
3336
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
3437
target: ${{ github.event.inputs.target }}
38+
branch: ${{ github.event.inputs.branch }}
3539
release_url: ${{ github.event.inputs.release_url }}
3640
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
3741

.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
target:
66
description: "The owner/repo GitHub target"
77
required: false
8+
branch:
9+
description: "The target branch"
10+
required: false
811
release_url:
912
description: "The URL of the draft GitHub release"
1013
required: false
@@ -34,6 +37,7 @@ jobs:
3437
target: ${{ github.event.inputs.target }}
3538
release_url: ${{ github.event.inputs.release_url }}
3639
steps_to_skip: ${{ github.event.inputs.steps_to_skip }}
40+
branch: ${{ github.event.inputs.branch }}
3741

3842
- name: "** Next Step **"
3943
run: |

jupyter_releaser/actions/draft_changelog.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
3+
import os
4+
35
from jupyter_releaser.actions.common import make_group, run_action, setup
4-
from jupyter_releaser.util import handle_since
6+
from jupyter_releaser.util import CHECKOUT_NAME, get_default_branch, handle_since
57

68
setup()
79

810
run_action("jupyter-releaser prep-git")
911

12+
# Handle the branch.
13+
if not os.environ.get("RH_BRANCH"):
14+
cur_dir = os.getcwd()
15+
os.chdir(CHECKOUT_NAME)
16+
os.environ["RH_BRANCH"] = get_default_branch() or ""
17+
os.chdir(cur_dir)
18+
1019
# Capture the "since" variable in case we add tags before checking changelog
1120
# Do this before bumping the version.
1221
with make_group("Handle RH_SINCE"):

jupyter_releaser/changelog.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
START_MARKER = "<!-- <START NEW CHANGELOG ENTRY> -->"
1111
END_MARKER = "<!-- <END NEW CHANGELOG ENTRY> -->"
1212
PR_PREFIX = "Automated Changelog Entry"
13+
PRECOMMIT_PREFIX = "[pre-commit.ci] pre-commit autoupdate"
1314

1415

1516
def format_pr_entry(target, number, auth=None, dry_run=False):
@@ -133,6 +134,9 @@ def get_version_entry(
133134
# Remove automated changelog PRs
134135
entry = [e for e in entry if PR_PREFIX not in e]
135136

137+
# Remove Pre-Commit PRs
138+
entry = [e for e in entry if PRECOMMIT_PREFIX not in e]
139+
136140
entry = "\n".join(entry).strip()
137141

138142
# Remove empty documentation entry if only automated changelogs were there

jupyter_releaser/util.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,15 +553,19 @@ def prepare_environment():
553553
def handle_since():
554554
"""Capture the "since" argument in case we add tags before checking changelog."""
555555
if os.environ.get("RH_SINCE"):
556+
log(f"Using RH_SINCE from env: {os.environ.get('RH_SINCE')}")
556557
return
557558
curr_dir = os.getcwd()
558559
os.chdir(CHECKOUT_NAME)
559-
since_last_stable_env = os.environ.get("RH_SINCE_LAST_STABLE")
560-
since_last_stable = since_last_stable_env == "true"
560+
since_last_stable_env = os.environ.get("RH_SINCE_LAST_STABLE", "")
561+
since_last_stable = since_last_stable_env.lower() == "true"
562+
log(f"Since last stable? {since_last_stable}")
561563
since = get_latest_tag(os.environ.get("RH_BRANCH"), since_last_stable)
562564
if since:
563565
log(f"Capturing {since} in RH_SINCE variable")
564566
os.environ["RH_SINCE"] = since
567+
else:
568+
log("No last stable found!")
565569
os.chdir(curr_dir)
566570
return since
567571

0 commit comments

Comments
 (0)