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
29 changes: 18 additions & 11 deletions .github/workflows/gh-aw-docs-review.lock.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions .github/workflows/gh-aw-docs-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,28 @@ steps:
env:
GH_TOKEN: ${{ github.token }}
REVIEW_SCOPE: ${{ inputs.review-scope }}
# Expressions propagate the original event context even through workflow_call;
# $GITHUB_EVENT_PATH on disk only has the workflow_call payload when called
# via uses:, so we pass the PR number via env to avoid the jq returning empty.
PR_NUMBER_FROM_CONTEXT: ${{ github.event.pull_request.number || github.event.issue.number }}
run: |
set -euo pipefail
mkdir -p /tmp/gh-aw/docs-review-data/scope

PR_NUMBER=$(jq -r 'if .pull_request then .pull_request.number elif .issue.pull_request then .issue.number else empty end' "$GITHUB_EVENT_PATH")
PR_NUMBER="$PR_NUMBER_FROM_CONTEXT"
if [ -z "$PR_NUMBER" ]; then
PR_NUMBER=$(jq -r 'if .pull_request then .pull_request.number elif .issue.pull_request then .issue.number else empty end' "$GITHUB_EVENT_PATH")
fi
if [ -z "$PR_NUMBER" ]; then
: > /tmp/gh-aw/docs-review-data/eligible-files.txt
echo '{}' > /tmp/gh-aw/docs-review-data/vale.json
echo '{"finding_count":0,"file_count":0,"eligible_count":0,"vale_exit":0,"skipped":"not a pull request context"}' > /tmp/gh-aw/docs-review-data/vale-stats.json
echo '{"pr_number":null,"is_pr_context":false}' > /tmp/gh-aw/docs-review-data/trigger-context.json
exit 0
fi

echo "{\"pr_number\":$PR_NUMBER,\"is_pr_context\":true}" > /tmp/gh-aw/docs-review-data/trigger-context.json

if [ "$REVIEW_SCOPE" != "docs-subtree" ] && [ "$REVIEW_SCOPE" != "repo-wide-markdown" ]; then
: > /tmp/gh-aw/docs-review-data/eligible-files.txt
echo '{}' > /tmp/gh-aw/docs-review-data/vale.json
Expand Down Expand Up @@ -218,7 +228,7 @@ Configured review scope for this run: `${{ inputs.review-scope }}`.

When the workflow runs:

- Confirm that the triggering item is a pull request or a PR comment context. If this is not a PR context, call `noop` with a short explanation.
- Read `/tmp/gh-aw/docs-review-data/trigger-context.json` first. If `is_pr_context` is `false`, call `noop`. If `is_pr_context` is `true`, proceed — `pr_number` contains the resolved PR number. Do not use the `pull-request-number` context variable to gate this check: for `issue_comment` triggers (e.g., the AI PR menu), `pull-request-number` is always null even on real PRs.
- Validate `inputs.review-scope`. If it is not `docs-subtree` or `repo-wide-markdown`, call `noop` with a short explanation.
- Review only files that both changed in the PR and match the configured review scope.
- Ignore every other changed file outside the configured review scope.
Expand Down
Loading