Skip to content
Open
Changes from 1 commit
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
44 changes: 44 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 @@ -60,6 +61,49 @@ jobs:
dotnet run --project ./src/RazorPagesProject/RazorPagesProject.csproj --no-build &
dotnet test ./src/RazorPagesProject.E2ETests

- name: Install GitHub Copilot CLI
if: ${{ github.event_name == 'pull_request' }}
run: npm install -g @github/copilot

- name: Configure Copilot CLI trusted folder
if: ${{ github.event_name == 'pull_request' }}
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
if: ${{ github.event_name == 'pull_request' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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

- name: Upload logs
uses: actions/upload-artifact@v4
if: failure()
Expand Down
Loading