Skip to content
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
4 changes: 3 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ Available recipes:
[Process]
branch branchname # start a new branch
merge # merge PR and return to starting point
pr # PR create 3.8
pr # PR create v4.0
pr_checks # watch GHAs then check for Copilot suggestions
pr_update # update the Done section of PR description with current commits
pr_verify # add or append to Verify section from stdin
prweb # view PR in web browser
release rel_version # make a release
sync # escape from branch, back to starting point
Expand Down
30 changes: 30 additions & 0 deletions .just/RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@ This file tracks the evolution of the Git/GitHub workflow automation module.

## November 2025 - The Polish Updates

### v4.0 - PR Description Management (#44)

Added two new recipes for managing pull request descriptions dynamically:

- **`pr_update`** - Updates the "Done" section of the PR description with the
current list of commits from the branch. Extracts commits using `git cherry`,
preserves other sections (Meta, Verify, etc.), and updates the PR body via
`gh pr edit`. Useful when you add commits after PR creation and want to keep
the description in sync.

- **`pr_verify`** - Adds or appends content to a "Verify" section in the PR
description. Reads from stdin, timestamps each entry, and formats as a code
block. If no Verify section exists, creates one before the Meta section. If
one exists, appends new timestamped entries. Perfect for logging test results
or verification steps.

Both recipes include a new sanity check (`_on_a_pull_request`) that verifies
you're on a branch with an active pull request before attempting updates. This
prevents cryptic errors when running these commands outside of PR context.

Other improvements in this release:

- Simplified bash strict mode settings (removed `-x` tracing flag)
- Standardized PR existence checks across recipes
- Better error handling with exit code 103 for missing PRs
- Initialize awk variables properly to avoid undefined behavior
- Updated documentation to show new recipes

**Related PRs:** [#44](https://github.com/fini-net/template-repo/pull/44)

### v3.9 - Shellcheck Error Fixes (#40)

Before adding the shellcheck tooling in v3.8bis, we knew there were a bunch of
Expand Down
148 changes: 144 additions & 4 deletions .just/gh-process.just
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ sync:
git pull
git status --porcelain # stp

# PR create v3.9
# PR create v4.0
[group('Process')]
pr: _has_commits && pr_checks
#!/usr/bin/env bash
set -euxo pipefail # strict mode
set +x # leave tracing off...
set -euo pipefail # strict mode

# handle optional pre-pr hook (for things like hugo)
if [[ -e ".just/pr-hook.just" ]]; then
Expand Down Expand Up @@ -122,6 +121,18 @@ _main_branch:
exit 102
fi

# error if not on a branch with a pull request
[group('sanity check')]
[no-cd]
_on_a_pull_request: _on_a_branch
#!/bin/bash
set -euo pipefail # strict mode

if \! gh pr view &>/dev/null; then
echo "No PR found for current branch"
exit 103
fi

# print UTC date in ISO format
[group('Utility')]
[no-cd]
Expand All @@ -135,7 +146,7 @@ release rel_version:

# watch GHAs then check for Copilot suggestions
[group('Process')]
pr_checks:
pr_checks: _on_a_pull_request
#!/usr/bin/env bash

gh pr checks --watch -i 5
Expand Down Expand Up @@ -177,3 +188,132 @@ pr_checks:
# did Claude comment?
echo -e "\n\n🟧🟠🔶🔸 Claude:"
gh pr view --json comments --jq '[.comments[] | select(.author.login == "claude")] | last | .body'

# update the Done section of PR description with current commits
[group('Process')]
pr_update: _on_a_pull_request
#!/usr/bin/env bash
set -euo pipefail # strict mode

CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"

# get current PR body
bodyfile=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
gh pr view --json body --jq '.body' > "$bodyfile"

# create new Done section
new_done_section=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
{
echo "## Done"
echo ""
git cherry -v "{{ release_branch }}" "$CURRENT_BRANCH" | sed -e 's/^[+] [0-9a-f]* /- /'
echo ""
} > "$new_done_section"

# extract everything after Done section (preserve other sections)
other_sections=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
awk '/^## Done/,/^## / {if (/^## / && !/^## Done/) {found=1}} found {print}' "$bodyfile" > "$other_sections"

# if no other sections found after Done, preserve everything after Done
if [ ! -s "$other_sections" ]; then
# look for content after the Done section's commit list
awk 'BEGIN {in_done=0; after_done=0; empty_count=0}
/^## Done/ {in_done=1; next}
in_done && /^$/ {empty_count++; if (empty_count >= 2) after_done=1; next}
in_done && /^- / {next}
after_done {print}' "$bodyfile" > "$other_sections"
fi

# combine new Done section with preserved sections
updated_body=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
cat "$new_done_section" "$other_sections" > "$updated_body"

echo ''
cat "$updated_body"
echo ''

# update PR body
gh pr edit --body-file "$updated_body"

# cleanup
rm "$bodyfile" "$new_done_section" "$other_sections" "$updated_body"

# add or append to Verify section from stdin
[group('Process')]
pr_verify: _on_a_pull_request
#!/usr/bin/env bash
set -euo pipefail # strict mode

# read stdin into a temp file
stdin_content=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
cat > "$stdin_content"

# get current PR body
bodyfile=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
gh pr view --json body --jq '.body' > "$bodyfile"

# get current datetime
DATETIME=$(date '+%Y-%m-%d %H:%M:%S %Z')

# check if Verify section exists
if grep -q '^## Verify' "$bodyfile"; then
# append to existing Verify section
updated_body=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
awk -v datetime="$DATETIME" '
/^## Verify/ {
in_verify=1
print
next
}
/^## / && in_verify {
# found next section, insert content before it
print ""
print "### " datetime
print ""
print "```"
system("cat '"$stdin_content"'")
print "```"
print ""
in_verify=0
}
{ print }
END {
# if still in verify section at end, append content
if (in_verify) {
print ""
print "### " datetime
print ""
print "```"
system("cat '"$stdin_content"'")
print "```"
}
}
' "$bodyfile" > "$updated_body"
else
# create new Verify section before Meta section
updated_body=$(mktemp /tmp/justfile.XXXXXX)
Copy link

Copilot AI Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using predictable temp file patterns in /tmp can create security vulnerabilities. Consider using mktemp without a template argument to create truly random temp files, or use mktemp -t justfile.XXXXXX for safer temp file creation.

Copilot uses AI. Check for mistakes.
awk -v datetime="$DATETIME" '
/^## Meta/ {
# insert Verify section before Meta
print "## Verify"
print ""
print "### " datetime
print ""
print "```"
system("cat '"$stdin_content"'")
print "```"
print ""
}
{ print }
' "$bodyfile" > "$updated_body"
fi

echo ''
cat "$updated_body"
echo ''

# update PR body
gh pr edit --body-file "$updated_body"

# cleanup
rm "$stdin_content" "$bodyfile" "$updated_body"
Loading