Skip to content

Commit c9ff482

Browse files
committed
standardize check for being on a PR
1 parent 52292f0 commit c9ff482

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.just/gh-process.just

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@ _main_branch:
121121
exit 102
122122
fi
123123

124+
# error if not on a branch with a pull request
125+
[group('sanity check')]
126+
[no-cd]
127+
_on_a_pull_request: _on_a_branch
128+
#!/bin/bash
129+
set -euo pipefail # strict mode
130+
131+
if \! gh pr view &>/dev/null; then
132+
echo "No PR found for current branch"
133+
exit 1
134+
fi
135+
124136
# print UTC date in ISO format
125137
[group('Utility')]
126138
[no-cd]
@@ -134,7 +146,7 @@ release rel_version:
134146

135147
# watch GHAs then check for Copilot suggestions
136148
[group('Process')]
137-
pr_checks:
149+
pr_checks: _on_a_pull_request
138150
#!/usr/bin/env bash
139151

140152
gh pr checks --watch -i 5
@@ -179,15 +191,10 @@ pr_checks:
179191

180192
# update the Done section of PR description with current commits
181193
[group('Process')]
182-
pr_update: _on_a_branch
194+
pr_update: _on_a_pull_request
183195
#!/usr/bin/env bash
184196
set -euo pipefail # strict mode
185197

186-
if \! gh pr view &>/dev/null; then
187-
echo "No PR found for current branch"
188-
exit 1
189-
fi
190-
191198
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
192199

193200
# get current PR body
@@ -233,7 +240,7 @@ pr_update: _on_a_branch
233240

234241
# add or append to Verify section from stdin
235242
[group('Process')]
236-
pr_verify: _on_a_branch
243+
pr_verify: _on_a_pull_request
237244
#!/usr/bin/env bash
238245
set -euo pipefail # strict mode
239246

0 commit comments

Comments
 (0)