Skip to content
Open
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
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: CI

permissions:
contents: read
pull-requests: read

on:
pull_request:
Expand Down Expand Up @@ -66,3 +67,54 @@ jobs:
with:
name: logs
path: src/RazorPagesProject.E2ETests/bin/Debug/net9.0/logs

copilot-review:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.COPILOT_PAT }}
steps:
- uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: '.node-version'

- name: Install GitHub Copilot CLI
run: npm install -g @github/copilot

- name: Configure Copilot CLI trusted folder
run: |
CONFIG_DIR="$HOME/.copilot"
CONFIG_FILE="$CONFIG_DIR/config.json"
WORKSPACE_PATH="${{ github.workspace }}"

mkdir -p "$CONFIG_DIR"

if [ -f "$CONFIG_FILE" ]; then
tmp_file="$(mktemp)"
jq --arg dir "$WORKSPACE_PATH" '
.trusted_folders = (.trusted_folders // []) |
if (.trusted_folders | index($dir)) == null then
.trusted_folders += [$dir]
else
.
end
' "$CONFIG_FILE" > "$tmp_file"
mv "$tmp_file" "$CONFIG_FILE"
Comment on lines +95 to +105
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

The script uses jq without ensuring it's installed. GitHub Actions runners may not have jq pre-installed, which would cause this step to fail. Consider installing jq first or using a different approach for JSON manipulation.

Copilot uses AI. Check for mistakes.

else
printf '{\n "trusted_folders": [\n "%s"\n ]\n}\n' "$WORKSPACE_PATH" > "$CONFIG_FILE"
fi

- name: Run GitHub Copilot CLI review
run: |
REVIEW_URL="https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
copilot -p "Check the changes made in PR ${REVIEW_URL}. Identify critical bugs, test gaps, and security concerns. Summarize your findings with sections for Summary, Risks, and Suggested Actions. Always Respond in Japanese." > copilot-review.md
Copy link

Copilot AI Sep 29, 2025

Choose a reason for hiding this comment

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

The command syntax is incorrect for GitHub Copilot CLI. The correct command should be gh copilot suggest or similar, as Copilot CLI is typically accessed through the GitHub CLI (gh) tool, not as a standalone copilot command.

Suggested change
copilot -p "Check the changes made in PR ${REVIEW_URL}. Identify critical bugs, test gaps, and security concerns. Summarize your findings with sections for Summary, Risks, and Suggested Actions. Always Respond in Japanese." > copilot-review.md
gh copilot review --url "$REVIEW_URL" --prompt "Check the changes made in PR ${REVIEW_URL}. Identify critical bugs, test gaps, and security concerns. Summarize your findings with sections for Summary, Risks, and Suggested Actions. Always Respond in Japanese." > copilot-review.md

Copilot uses AI. Check for mistakes.


echo "### GitHub Copilot CLI Review" >> "$GITHUB_STEP_SUMMARY"
if [ -s copilot-review.md ]; then
cat copilot-review.md >> "$GITHUB_STEP_SUMMARY"
else
echo "No review output was produced." >> "$GITHUB_STEP_SUMMARY"
fi