Skip to content
Merged
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
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: build clean rebuild test typecheck
.PHONY: bench bench-search bench-init bench-concurrent
.PHONY: release-tag release-push
.PHONY: wf-release wf-publish wf-ci wf-list wf-watch

# Build
build:
Expand Down Expand Up @@ -37,3 +38,41 @@ release-tag:

release-push:
git push --follow-tags

# Workflows (requires gh cli + fzf)
# Trigger release PR workflow with interactive prompts
wf-release:
@TYPE=$$(echo -e "auto\npatch\nminor\nmajor" | fzf --prompt="Version type: " --height=6 --reverse); \
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

Missing error handling if fzf is cancelled (Ctrl+C or ESC). When a user cancels fzf, TYPE will be empty and the workflow will still be triggered with an empty version type. Add a check after the fzf call to exit if TYPE is empty.

Suggested change
@TYPE=$$(echo -e "auto\npatch\nminor\nmajor" | fzf --prompt="Version type: " --height=6 --reverse); \
@TYPE=$$(echo -e "auto\npatch\nminor\nmajor" | fzf --prompt="Version type: " --height=6 --reverse); \
if [ -z "$$TYPE" ]; then \
echo "Release workflow cancelled."; \
exit 1; \
fi; \

Copilot uses AI. Check for mistakes.
if [ "$$TYPE" = "auto" ]; then \

Choose a reason for hiding this comment

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

high

If the user cancels the fzf prompt on the previous line (e.g., by pressing Esc), the TYPE variable will be empty. The script currently doesn't handle this case and proceeds to trigger the workflow with an empty version_type, which could lead to unexpected behavior or workflow failure. You should add a check to ensure TYPE is not empty before proceeding.

	if [ -z "$$TYPE" ]; then exit 1; elif [ "$$TYPE" = "auto" ]; then \

read -p "Custom version (leave empty for auto): " VERSION; \
fi; \
echo "→ Triggering release: type=$$TYPE version=$${VERSION:-auto}"; \
gh workflow run release-pr.yml \
-f version_type=$$TYPE \
$${VERSION:+-f custom_version=$$VERSION}; \
sleep 2; \
$(MAKE) wf-watch W=release-pr.yml
Comment on lines +53 to +54

Choose a reason for hiding this comment

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

medium

Using a fixed sleep 2 introduces a potential race condition. If the GitHub API is slow to create the new workflow run, wf-watch might start watching an older run instead of the one just triggered. While this might work most of the time, it's not fully reliable. For a more robust solution, you might consider implementing a polling mechanism to wait for the new run to appear before watching it. However, given the context of a Makefile helper, this might be an acceptable trade-off for simplicity.


# Re-run failed publish workflow: make wf-publish [RUN=<run-id>]
wf-publish:
$(if $(RUN),\
gh run rerun $(RUN),\
gh run rerun --failed -w release-publish.yml)
@sleep 2
@$(MAKE) wf-watch W=release-publish.yml
Comment on lines +61 to +62

Choose a reason for hiding this comment

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

medium

Similar to other workflow-triggering targets, using a fixed sleep 2 here introduces a potential race condition. The wf-watch command might end up watching the wrong workflow if the new run isn't available in the API within 2 seconds. This approach is not fully reliable, although it may be a reasonable trade-off for simplicity in a Makefile.


# Trigger CI workflow on current branch
wf-ci:
gh workflow run ci.yml --ref $(shell git branch --show-current)
Comment on lines +64 to +66
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The ci.yml workflow does not have workflow_dispatch trigger configured, so it cannot be manually triggered. The workflow only runs on push/pull_request events. Add workflow_dispatch: to the workflow's on: section in .github/workflows/ci.yml for this target to work.

Suggested change
# Trigger CI workflow on current branch
wf-ci:
gh workflow run ci.yml --ref $(shell git branch --show-current)
# Re-run CI workflow: make wf-ci [RUN=<run-id>]
wf-ci:
$(if $(RUN),\
gh run rerun $(RUN),\
gh run rerun --failed -w ci.yml)

Copilot uses AI. Check for mistakes.
@sleep 2
@$(MAKE) wf-watch W=ci.yml
Comment on lines +67 to +68

Choose a reason for hiding this comment

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

medium

The use of sleep 2 before watching the workflow creates a potential race condition. If the new workflow run isn't visible via the API within two seconds, wf-watch could attach to an older run. This is a fragile pattern, though it might be an acceptable simplification for a developer tool.


# List recent workflow runs: make wf-list [W=<workflow>] [N=10]
wf-list:
gh run list $(if $(W),-w $(W)) -L $(or $(N),10)

# Watch latest workflow run: make wf-watch [W=<workflow>] [RUN=<run-id>]
wf-watch:
$(if $(RUN),\
gh run watch $(RUN),\
gh run watch $(shell gh run list $(if $(W),-w $(W)) -L 1 --json databaseId -q '.[0].databaseId'))
Comment on lines +76 to +78
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

The command will fail silently if no workflow runs exist (the jq query '.[0].databaseId' returns null for empty arrays). Add error handling to check if a run exists before calling gh run watch.

Suggested change
$(if $(RUN),\
gh run watch $(RUN),\
gh run watch $(shell gh run list $(if $(W),-w $(W)) -L 1 --json databaseId -q '.[0].databaseId'))
@if [ -n "$(RUN)" ]; then \
gh run watch $(RUN); \
else \
RUN_ID=$$(gh run list $(if $(W),-w $(W)) -L 1 --json databaseId -q '.[0].databaseId'); \
if [ -z "$$RUN_ID" ]; then \
echo "No workflow runs found to watch." >&2; \
exit 1; \
fi; \
gh run watch $$RUN_ID; \
fi

Copilot uses AI. Check for mistakes.