Skip to content

Commit c617313

Browse files
committed
Add an action for check-links
1 parent cb282bf commit c617313

File tree

5 files changed

+77
-8
lines changed

5 files changed

+77
-8
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Check Links"
2+
description: "Run a link check function for a repo"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- shell: bash
7+
id: check-links
8+
run: |
9+
set -eux
10+
11+
# Set up env variables
12+
export RH_REPOSITORY=${GITHUB_REPOSITORY}
13+
export RH_REF=${GITHUB_REF}
14+
15+
if [ ! -z ${GITHUB_BASE_REF} ]; then
16+
echo "Using GITHUB_BASE_REF: ${GITHUB_BASE_REF}"
17+
export RH_BRANCH=${GITHUB_BASE_REF}
18+
else
19+
# e.g refs/head/foo or refs/tag/bar
20+
echo "Using GITHUB_REF: ${GITHUB_REF}"
21+
export RH_BRANCH=$(echo ${GITHUB_REF} | cut -d'/' -f 3-)
22+
fi
23+
24+
# Install Jupyter Releaser from git unless we are testing Releaser itself
25+
if ! command -v jupyter-releaser &> /dev/null
26+
then
27+
pip install git+https://github.com/jupyter-server/jupyter_releaser.git
28+
fi
29+
30+
jupyter-releaser prep-git
31+
jupyter-releaser check-links --force

.github/workflows/check-release.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ jobs:
3434
restore-keys: |
3535
${{ runner.os }}-pip-
3636
${{ runner.os }}-pip-
37-
- name: Cache checked links
38-
uses: actions/cache@v2
39-
with:
40-
path: ~/.cache/pytest-link-check
41-
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/*.md') }}-md-links
42-
restore-keys: |
43-
${{ runner.os }}-linkcheck-
4437
- name: Print env
4538
run: env
4639
- name: Upgrade packaging dependencies

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,42 @@ jobs:
2929
echo "or after-the-fact on already committed files with"
3030
echo " pre-commit run --all-files"
3131
32+
check-links:
33+
runs-on: ubuntu-20.04
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: actions/setup-python@v2
38+
with:
39+
python-version: 3.9
40+
- name: Get pip cache dir
41+
id: pip-cache
42+
run: |
43+
echo "::set-output name=dir::$(pip cache dir)"
44+
- name: Cache pip
45+
uses: actions/cache@v2
46+
with:
47+
path: ${{ steps.pip-cache.outputs.dir }}
48+
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.cfg') }}
49+
restore-keys: |
50+
${{ runner.os }}-pip-${{ matrix.python-version }}-
51+
${{ runner.os }}-pip-
52+
- name: Install the Python dependencies
53+
run: |
54+
pip install -e .[test] codecov
55+
- name: Cache checked links
56+
uses: actions/cache@v2
57+
with:
58+
path: ~/.cache/pytest-link-check
59+
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/*.md') }}-md-links
60+
restore-keys: |
61+
${{ runner.os }}-linkcheck-
62+
- name: Install the Python dependencies
63+
run: |
64+
pip install -e .[test] codecov
65+
- name: Check Links
66+
uses: ./.github/actions/check-links
67+
3268
build:
3369
runs-on: ${{ matrix.os }}-latest
3470
strategy:

jupyter_releaser/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def invoke(self, ctx):
5151
hooks = config.get("hooks", {})
5252
options = config.get("options", {})
5353
skip = config.get("skip", [])
54+
if "--force" in ctx.args:
55+
skip = []
56+
ctx.args.remove("--force")
5457

5558
# Print a separation header
5659
util.log(f'\n\n{"-" * 50}')
@@ -119,7 +122,10 @@ def list_commands(self, ctx):
119122

120123

121124
@click.group(cls=ReleaseHelperGroup)
122-
def main():
125+
@click.option(
126+
"--force", default=False, help="Force a command to run even when skipped by config"
127+
)
128+
def main(force):
123129
"""Jupyter Releaser scripts"""
124130
pass
125131

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@ tag_template = "v{new_version}"
1919
[[tool.tbump.file]]
2020
src = "jupyter_releaser/__init__.py"
2121

22+
[tool.jupyter-releaser]
23+
skip = ["check-links"]
24+
2225
[tool.jupyter-releaser.hooks]
2326
after-draft-release = "bash ./.github/scripts/bump_tag.sh"

0 commit comments

Comments
 (0)