Skip to content

Commit a3ccd97

Browse files
ivanmilevtuesclaudeampagent
authored
feat: preview picked pull requests and email the author from a setup PR's run (#152)
* feat: preview picked pull requests and email the author from a setup PR's run Before a setup PR merges, its own run is the only one GitHub starts for us. That run now reviews up to three open pull requests the app lists in the setup PR's description (<!-- codeboarding:preview 412,409,401 -->), each applied to the commit the map was built from and analysed incrementally from it, and uploads each as codeboarding-preview-<run>-<attempt>-pr<n>. Nothing is posted on those pull requests. The sticky review comment is edited, and edits send no notification, so the run also posts one new comment on the setup PR when the first preview (or, without previews, the map) is ready. GitHub emails it to the PR's author, who is the person who asked for the map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: name each preview artifact for its pull request and head The app attributes an artifact to a pull request per run, and every preview shares the setup PR's run, so the name carries the pull request and the head it reviewed, as the legacy codeboarding-pr-<pr>-<head> names did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * style: format setup preview tests with Black Amp-Thread-ID: https://ampcode.com/threads/T-01a17775-d386-7387-88ab-c14a99ed558e Co-authored-by: Amp <amp@ampcode.com> * fix: satisfy shellcheck in setup preview scripts Amp-Thread-ID: https://ampcode.com/threads/T-01a17775-d386-7387-88ab-c14a99ed558e Co-authored-by: Amp <amp@ampcode.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Amp <amp@ampcode.com>
1 parent 220c739 commit a3ccd97

8 files changed

Lines changed: 743 additions & 14 deletions

‎action.yml‎

Lines changed: 157 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -617,14 +617,11 @@ runs:
617617
MODEL: ${{ inputs.model }}
618618
AGENT_MODEL_INPUT: ${{ inputs.agent_model }}
619619
PARSING_MODEL_INPUT: ${{ inputs.parsing_model }}
620+
# A setup PR's run goes on to preview other pull requests; the credentials stay until
621+
# those finish and the step after them removes them.
622+
KEEP_AUTH: ${{ github.event_name == 'pull_request' && github.head_ref == 'codeboarding/setup-action' }}
620623
run: '"$GITHUB_ACTION_PATH/scripts/action/with-auth.sh" "$GITHUB_ACTION_PATH/scripts/action/review-analyze-head.sh"'
621624

622-
# The head step removes the credentials; this covers a run that failed before it.
623-
- name: Remove analysis credentials
624-
if: always() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review'
625-
shell: bash
626-
run: '"$GITHUB_ACTION_PATH/scripts/action/clear-auth.sh"'
627-
628625
# Published before the review is rendered: the analysis is the expensive part,
629626
# so a later rendering or posting failure must not throw it away. Only the
630627
# next run reads this, hence the short retention.
@@ -730,6 +727,160 @@ runs:
730727
GITHUB_TOKEN: ${{ inputs.github_token }}
731728
path: ${{ steps.review_body.outputs.path }}
732729

730+
# Before a setup PR merges, its own run is the only one GitHub starts for us, so this is
731+
# where a new user's open pull requests get their first review: the ones the app listed
732+
# in the setup PR's description, each applied to the commit this run just analysed and
733+
# analysed incrementally from it (see review-preview-pr.sh). Nothing is posted on them.
734+
# The app finds each as codeboarding-preview-<run>-<attempt>-pr<number>-<head sha>.
735+
# Not codeboarding-review-<run>-...: the app takes the newest artifact with that prefix as
736+
# the setup PR's own review, so a preview named that way would replace the setup PR's map.
737+
# All best effort: the setup PR's map is already uploaded and must not fail because of them.
738+
- name: Resolve pull requests to preview
739+
id: preview_list
740+
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.review_comment.outcome == 'success' && github.event_name == 'pull_request' && github.head_ref == 'codeboarding/setup-action'
741+
continue-on-error: true
742+
shell: bash
743+
env:
744+
GH_TOKEN: ${{ inputs.github_token }}
745+
GH_HOST: ${{ github.server_url }}
746+
REPOSITORY: ${{ github.repository }}
747+
PR_NUMBER: ${{ steps.guard.outputs.pr_number }}
748+
HEAD_REF: ${{ github.head_ref }}
749+
BASE_REF: ${{ steps.guard.outputs.base_ref }}
750+
MAX_PREVIEWS: '3'
751+
run: "$GITHUB_ACTION_PATH/scripts/action/resolve-preview-prs.sh"
752+
753+
- name: Preview pull request 1 for the setup PR
754+
id: preview_1
755+
if: steps.guard.outputs.mode == 'review' && steps.preview_list.outputs.count >= 1
756+
continue-on-error: true
757+
shell: bash
758+
env:
759+
ACTION_PATH: ${{ github.action_path }}
760+
CHECKOUT_DIR: ${{ github.workspace }}/.codeboarding-target
761+
GIT_TOKEN: ${{ inputs.github_token }}
762+
REPOSITORY: ${{ github.repository }}
763+
SETUP_PR: ${{ steps.guard.outputs.pr_number }}
764+
REVIEW_BASE_SHA: ${{ steps.guard.outputs.merge_base_sha }}
765+
BASE_ANALYSIS_PATH: ${{ steps.review_baseline.outputs.base_analysis_path }}
766+
# The setup PR's own review artifact already records where the base graph lives.
767+
REVIEW_ARTIFACT_DIR: ${{ steps.review_artifact.outputs.artifact_dir }}
768+
ENGINE_VERSION: ${{ steps.state.outputs.engine_version }}
769+
CFG_HASH: ${{ steps.state.outputs.cfg_hash }}
770+
DEPTH_CAP: ${{ inputs.depth_cap }}
771+
MODEL: ${{ inputs.model }}
772+
AGENT_MODEL_INPUT: ${{ inputs.agent_model }}
773+
PARSING_MODEL_INPUT: ${{ inputs.parsing_model }}
774+
KEEP_AUTH: 'true'
775+
run: '"$GITHUB_ACTION_PATH/scripts/action/with-auth.sh" "$GITHUB_ACTION_PATH/scripts/action/review-preview-pr.sh" 1'
776+
777+
- name: Upload preview 1
778+
id: upload_preview_1
779+
if: steps.preview_1.outputs.artifact_dir != '' && github.server_url == 'https://github.com'
780+
continue-on-error: true
781+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
782+
with:
783+
name: codeboarding-preview-${{ github.run_id }}-${{ github.run_attempt }}-pr${{ steps.preview_1.outputs.pr_number }}-${{ steps.preview_1.outputs.head_sha }}
784+
path: ${{ steps.preview_1.outputs.artifact_dir }}
785+
if-no-files-found: error
786+
retention-days: 14
787+
788+
# The sticky review comment is an edit by now, and edits send no notification. One new
789+
# comment on a setup PR emails its author: after the first preview when there is one,
790+
# so the email links a coloured pull request, otherwise as soon as the map is posted.
791+
- name: Tell the setup PR's author the map is ready
792+
if: steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review' && steps.review_comment.outcome == 'success' && github.event_name == 'pull_request' && github.head_ref == 'codeboarding/setup-action'
793+
continue-on-error: true
794+
shell: bash
795+
env:
796+
GH_TOKEN: ${{ inputs.github_token }}
797+
GH_HOST: ${{ github.server_url }}
798+
REPOSITORY: ${{ github.repository }}
799+
PR_NUMBER: ${{ steps.guard.outputs.pr_number }}
800+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
801+
HEAD_REF: ${{ github.head_ref }}
802+
BASE_REF: ${{ steps.guard.outputs.base_ref }}
803+
FIRST_PR: ${{ steps.upload_preview_1.outcome == 'success' && steps.preview_1.outputs.pr_number || '' }}
804+
FIRST_TITLE: ${{ steps.preview_1.outputs.title }}
805+
PREVIEW_PRS: ${{ steps.preview_list.outputs.prs }}
806+
run: "$GITHUB_ACTION_PATH/scripts/action/notify-setup-ready.sh"
807+
808+
- name: Preview pull request 2 for the setup PR
809+
id: preview_2
810+
if: steps.guard.outputs.mode == 'review' && steps.preview_list.outputs.count >= 2
811+
continue-on-error: true
812+
shell: bash
813+
env:
814+
ACTION_PATH: ${{ github.action_path }}
815+
CHECKOUT_DIR: ${{ github.workspace }}/.codeboarding-target
816+
GIT_TOKEN: ${{ inputs.github_token }}
817+
REPOSITORY: ${{ github.repository }}
818+
SETUP_PR: ${{ steps.guard.outputs.pr_number }}
819+
REVIEW_BASE_SHA: ${{ steps.guard.outputs.merge_base_sha }}
820+
BASE_ANALYSIS_PATH: ${{ steps.review_baseline.outputs.base_analysis_path }}
821+
# The setup PR's own review artifact already records where the base graph lives.
822+
REVIEW_ARTIFACT_DIR: ${{ steps.review_artifact.outputs.artifact_dir }}
823+
ENGINE_VERSION: ${{ steps.state.outputs.engine_version }}
824+
CFG_HASH: ${{ steps.state.outputs.cfg_hash }}
825+
DEPTH_CAP: ${{ inputs.depth_cap }}
826+
MODEL: ${{ inputs.model }}
827+
AGENT_MODEL_INPUT: ${{ inputs.agent_model }}
828+
PARSING_MODEL_INPUT: ${{ inputs.parsing_model }}
829+
KEEP_AUTH: 'true'
830+
run: '"$GITHUB_ACTION_PATH/scripts/action/with-auth.sh" "$GITHUB_ACTION_PATH/scripts/action/review-preview-pr.sh" 2'
831+
832+
- name: Upload preview 2
833+
id: upload_preview_2
834+
if: steps.preview_2.outputs.artifact_dir != '' && github.server_url == 'https://github.com'
835+
continue-on-error: true
836+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
837+
with:
838+
name: codeboarding-preview-${{ github.run_id }}-${{ github.run_attempt }}-pr${{ steps.preview_2.outputs.pr_number }}-${{ steps.preview_2.outputs.head_sha }}
839+
path: ${{ steps.preview_2.outputs.artifact_dir }}
840+
if-no-files-found: error
841+
retention-days: 14
842+
843+
- name: Preview pull request 3 for the setup PR
844+
id: preview_3
845+
if: steps.guard.outputs.mode == 'review' && steps.preview_list.outputs.count >= 3
846+
continue-on-error: true
847+
shell: bash
848+
env:
849+
ACTION_PATH: ${{ github.action_path }}
850+
CHECKOUT_DIR: ${{ github.workspace }}/.codeboarding-target
851+
GIT_TOKEN: ${{ inputs.github_token }}
852+
REPOSITORY: ${{ github.repository }}
853+
SETUP_PR: ${{ steps.guard.outputs.pr_number }}
854+
REVIEW_BASE_SHA: ${{ steps.guard.outputs.merge_base_sha }}
855+
BASE_ANALYSIS_PATH: ${{ steps.review_baseline.outputs.base_analysis_path }}
856+
# The setup PR's own review artifact already records where the base graph lives.
857+
REVIEW_ARTIFACT_DIR: ${{ steps.review_artifact.outputs.artifact_dir }}
858+
ENGINE_VERSION: ${{ steps.state.outputs.engine_version }}
859+
CFG_HASH: ${{ steps.state.outputs.cfg_hash }}
860+
DEPTH_CAP: ${{ inputs.depth_cap }}
861+
MODEL: ${{ inputs.model }}
862+
AGENT_MODEL_INPUT: ${{ inputs.agent_model }}
863+
PARSING_MODEL_INPUT: ${{ inputs.parsing_model }}
864+
run: '"$GITHUB_ACTION_PATH/scripts/action/with-auth.sh" "$GITHUB_ACTION_PATH/scripts/action/review-preview-pr.sh" 3'
865+
866+
- name: Upload preview 3
867+
id: upload_preview_3
868+
if: steps.preview_3.outputs.artifact_dir != '' && github.server_url == 'https://github.com'
869+
continue-on-error: true
870+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
871+
with:
872+
name: codeboarding-preview-${{ github.run_id }}-${{ github.run_attempt }}-pr${{ steps.preview_3.outputs.pr_number }}-${{ steps.preview_3.outputs.head_sha }}
873+
path: ${{ steps.preview_3.outputs.artifact_dir }}
874+
if-no-files-found: error
875+
retention-days: 14
876+
877+
# The head and preview steps remove the credentials themselves; this covers a run that
878+
# failed before them, and a setup PR's run, which keeps them for its previews.
879+
- name: Remove analysis credentials
880+
if: always() && steps.guard.outputs.skip != 'true' && steps.guard.outputs.mode == 'review'
881+
shell: bash
882+
run: '"$GITHUB_ACTION_PATH/scripts/action/clear-auth.sh"'
883+
733884
# The same body, on the run page. Job summaries and logs are explicitly excluded from
734885
# the artifact storage allowance, and the cap is 1MiB per step against a diagram
735886
# measured in single-digit kilobytes, so this is free in both senses. It earns its

‎scripts/action/build-review-artifact.sh‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
#!/usr/bin/env bash
22
# Packages both analyses and PR metadata, then outputs the artifact upload directory.
33
set -euo pipefail
4-
mkdir -p "${RUNNER_TEMP}/cb-review-artifact"
5-
cp "$ANALYSIS_PATH" "${RUNNER_TEMP}/cb-review-artifact/analysis.json"
4+
# A setup PR's previews of other pull requests are packaged the same way, each into its own directory.
5+
dir="${ARTIFACT_DIR:-${RUNNER_TEMP}/cb-review-artifact}"
6+
mkdir -p "$dir"
7+
cp "$ANALYSIS_PATH" "$dir/analysis.json"
68
# The base graph is normally published separately, named for the commit it
79
# describes, so ten runs on one pull request store it once rather than ten times.
810
# A fork review publishes nothing another run could read, so when it had to
911
# compute the base itself it carries the graph here instead: otherwise the
1012
# artifact would name a base that does not exist and no reader could reproduce
1113
# the comparison.
1214
if [ "${INLINE_BASE:-false}" = true ]; then
13-
cp "$BASE_ANALYSIS_PATH" "${RUNNER_TEMP}/cb-review-artifact/base_analysis.json"
15+
cp "$BASE_ANALYSIS_PATH" "$dir/base_analysis.json"
1416
BASE_ARTIFACT_NAME=""
1517
fi
1618
# The engine writes this next to the analysis it came from. Ship it when present
1719
# so a pull request's warnings are readable without rerunning the analysis.
1820
HEALTH_REPORT="$(dirname "$ANALYSIS_PATH")/health/health_report.json"
19-
[ ! -f "$HEALTH_REPORT" ] || cp "$HEALTH_REPORT" "${RUNNER_TEMP}/cb-review-artifact/health_report.json"
21+
[ ! -f "$HEALTH_REPORT" ] || cp "$HEALTH_REPORT" "$dir/health_report.json"
2022

23+
# basis=preview marks a review made inside a setup PR's run: the pull request's own changes
24+
# laid over the commit that run analysed, not over its real merge base. setup_pr names that run's PR.
2125
# base_sha stays the event's base branch tip for consumers that key on it;
2226
# merge_base_sha records the commit the diagram actually compared against.
2327
# pr_base_sha carries the same value under the name the webview already reads:
@@ -37,10 +41,13 @@ jq -n \
3741
--arg base_artifact "$BASE_ARTIFACT_NAME" \
3842
--arg base_artifact_id "$BASE_ARTIFACT_ID" \
3943
--arg analysed_files_changed "${ANALYSED_FILES_CHANGED:-unknown}" \
44+
--arg basis "${BASIS:-}" \
45+
--arg setup_pr "${SETUP_PR:-}" \
4046
'{kind: $kind, mode: $mode, base_sha: $base_sha, merge_base_sha: $merge_base_sha, pr_base_sha: $merge_base_sha,
4147
merge_base_resolved: $merge_base_resolved, head_sha: $head_sha,
4248
pr_number: $pr_number, seed_source: $seed_source, chain_depth: $chain_depth,
4349
base_artifact: $base_artifact, base_artifact_id: $base_artifact_id,
44-
analysed_files_changed: $analysed_files_changed}' \
45-
> "${RUNNER_TEMP}/cb-review-artifact/metadata.json"
46-
echo "artifact_dir=${RUNNER_TEMP}/cb-review-artifact" >> "$GITHUB_OUTPUT"
50+
analysed_files_changed: $analysed_files_changed}
51+
+ (if $basis == "" then {} else {basis: $basis, setup_pr: $setup_pr} end)' \
52+
> "$dir/metadata.json"
53+
echo "artifact_dir=$dir" >> "$GITHUB_OUTPUT"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
# Tells the author of a CodeBoarding setup PR that its preview map is ready.
3+
#
4+
# The review comment is sticky: it is created when the run starts and edited when it
5+
# ends, and GitHub sends no notification for an edit. A new comment does notify the
6+
# PR's author, who for a setup PR is the person who asked for the map (the app opens
7+
# it with their token), so this one comment is what turns "you can close this tab"
8+
# into an email from GitHub. Failed runs need nothing here: GitHub already emails the
9+
# person who triggered a failed run.
10+
#
11+
# When the setup PR asked for previews of other pull requests, this runs after the first
12+
# one is ready (FIRST_PR) and links it, since a coloured pull request is the point; the
13+
# rest of PREVIEW_PRS are named as still running. Posted once per PR, found again by its
14+
# marker, so pushing new settings to the setup PR does not email again. Best effort throughout.
15+
set -euo pipefail
16+
[ "${HEAD_REF:-}" = "codeboarding/setup-action" ] || exit 0
17+
[ -n "${PR_NUMBER:-}" ] && [ -n "${REPOSITORY:-}" ] || exit 0
18+
export GH_HOST="${GH_HOST:-github.com}"
19+
GH_HOST="${GH_HOST#*://}"
20+
21+
marker="<!-- codeboarding-setup-ready -->"
22+
existing="$(gh api --paginate "repos/$REPOSITORY/issues/$PR_NUMBER/comments?per_page=100" \
23+
--jq ".[] | select((.body // \"\") | contains(\"$marker\")) | .id")"
24+
[ -z "$existing" ] || exit 0
25+
26+
# A mention notifies even an author who unsubscribed from the thread. Bots are not mentioned.
27+
greeting="Your"
28+
case "${PR_AUTHOR:-}" in
29+
"" | *"[bot]") ;;
30+
*) greeting="@$PR_AUTHOR your" ;;
31+
esac
32+
if [ -n "${BASE_REF:-}" ]; then
33+
branch="\`$BASE_REF\`"
34+
else
35+
branch="your default branch"
36+
fi
37+
link() { printf 'https://app.codeboarding.org/%s/pull/%s?utm_source=github&utm_medium=setup_ready&utm_campaign=gh_action' "$REPOSITORY" "$1"; }
38+
if [ -n "${FIRST_PR:-}" ]; then
39+
headline="$greeting CodeBoarding map of $branch is ready, and #$FIRST_PR is reviewed on it."
40+
cta="**[Open #$FIRST_PR in CodeBoarding]($(link "$FIRST_PR"))**${FIRST_TITLE:+ · $FIRST_TITLE}"
41+
rest=""
42+
IFS=',' read -r -a all <<< "${PREVIEW_PRS:-}"
43+
for pr in "${all[@]}"; do
44+
if [ -n "$pr" ] && [ "$pr" != "$FIRST_PR" ]; then rest+="${rest:+, }#$pr"; fi
45+
done
46+
[ -z "$rest" ] || cta+=$'\n\n'"$rest follow in a few minutes. [Your map]($(link "$PR_NUMBER")) is open already."
47+
else
48+
headline="$greeting CodeBoarding map of $branch is ready."
49+
cta="**[Open it in CodeBoarding]($(link "$PR_NUMBER"))**"
50+
fi
51+
body="$(printf '%s\n\n%s\n\n%s\n\n%s' \
52+
"$headline" \
53+
"$cta" \
54+
"This is a preview. Merge this PR to keep the map up to date and review every pull request." \
55+
"$marker")"
56+
gh api -X POST "repos/$REPOSITORY/issues/$PR_NUMBER/comments" -f body="$body" >/dev/null
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
# Reads which pull requests a CodeBoarding setup PR should preview, from a line the app
3+
# writes into its description:
4+
#
5+
# <!-- codeboarding:preview 412,409,401 -->
6+
#
7+
# Before the setup PR merges, its own run is the only one GitHub starts for us, so this is
8+
# where a new user's open pull requests get their first review. The description is read
9+
# now, after the map is built, not from the event payload, so a list changed while the map
10+
# was building still counts. Each entry must be an open pull request from this repository
11+
# into the same branch; anything else is skipped with a notice. At most MAX_PREVIEWS.
12+
#
13+
# Writes one JSON file per preview to $RUNNER_TEMP/codeboarding-preview/<n>.json and
14+
# outputs count= and prs= (comma-separated, in order). Best effort throughout.
15+
set -euo pipefail
16+
out="${RUNNER_TEMP:?}/codeboarding-preview"
17+
rm -rf "$out"
18+
mkdir -p "$out"
19+
count=0 prs=""
20+
finish() { printf 'count=%s\nprs=%s\n' "$count" "$prs" >> "${GITHUB_OUTPUT:-/dev/null}"; exit 0; }
21+
[ "${HEAD_REF:-}" = "codeboarding/setup-action" ] || finish
22+
[ -n "${PR_NUMBER:-}" ] && [ -n "${REPOSITORY:-}" ] && [ -n "${BASE_REF:-}" ] || finish
23+
export GH_HOST="${GH_HOST:-github.com}"
24+
GH_HOST="${GH_HOST#*://}"
25+
max="${MAX_PREVIEWS:-3}"
26+
27+
body="$(gh api "repos/$REPOSITORY/pulls/$PR_NUMBER" --jq '.body // ""' 2>/dev/null || true)"
28+
line="$(grep -oE '<!-- codeboarding:preview [0-9, ]+ -->' <<< "$body" | head -n 1 || true)"
29+
[ -n "$line" ] || finish
30+
31+
skip() { echo "::notice::Not previewing #$1: $2"; }
32+
seen=" "
33+
while IFS= read -r pr; do
34+
[ "$count" -lt "$max" ] || { skip "$pr" "at most $max pull requests are previewed."; continue; }
35+
[ "$pr" != "$PR_NUMBER" ] || continue
36+
case "$seen" in *" $pr "*) continue ;; esac
37+
seen+="$pr "
38+
if ! json="$(gh api "repos/$REPOSITORY/pulls/$pr" 2>/dev/null)"; then
39+
skip "$pr" "it could not be read."
40+
continue
41+
fi
42+
IFS=$'\t' read -r state head_repo base_ref base_sha head_sha < <(jq -r \
43+
'[.state, (.head.repo.full_name // ""), .base.ref, .base.sha, .head.sha] | @tsv' <<< "$json")
44+
[ "$state" = open ] || { skip "$pr" "it is not open."; continue; }
45+
[ "$head_repo" = "$REPOSITORY" ] || { skip "$pr" "it comes from a fork."; continue; }
46+
[ "$base_ref" = "$BASE_REF" ] || { skip "$pr" "it targets $base_ref, not $BASE_REF."; continue; }
47+
# The pull request's own changes are what it adds since its merge base, the same
48+
# comparison GitHub's Files tab makes.
49+
merge_base="$(gh api "repos/$REPOSITORY/compare/$base_sha...$head_sha" --jq '.merge_base_commit.sha // ""' 2>/dev/null || true)"
50+
[ -n "$merge_base" ] || { skip "$pr" "its merge base could not be resolved."; continue; }
51+
count=$(( count + 1 ))
52+
jq -n --arg pr "$pr" --arg head_sha "$head_sha" --arg merge_base "$merge_base" \
53+
--arg title "$(jq -r '.title // ""' <<< "$json")" \
54+
'{pr_number: $pr, head_sha: $head_sha, merge_base_sha: $merge_base, title: $title}' > "$out/$count.json"
55+
prs="${prs:+$prs,}$pr"
56+
done < <(grep -oE '[0-9]+' <<< "${line#*preview}")
57+
finish

0 commit comments

Comments
 (0)