-
Notifications
You must be signed in to change notification settings - Fork 0
chore(ci): add GitHub Copilot CLI installation and review for pull re… #520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SIkebe
wants to merge
5
commits into
main
Choose a base branch
from
copilot-cli-review
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
20d1bad
chore(ci): add GitHub Copilot CLI installation and review for pull re…
SIkebe a821d79
chore(ci): add authentication step for GitHub Copilot CLI review
SIkebe 8295970
chore(ci): enhance GitHub Copilot CLI integration and add authenticat…
SIkebe 26e0ed9
chore(ci): remove dependency on CI job success for Copilot review step
SIkebe e4b8aa6
chore(ci): add GitHub Copilot CLI authentication step and configure e…
SIkebe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ name: CI | |||||
|
||||||
permissions: | ||||||
contents: read | ||||||
pull-requests: read | ||||||
|
||||||
on: | ||||||
pull_request: | ||||||
|
@@ -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" | ||||||
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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
|
||||||
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() | ||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 havejq
pre-installed, which would cause this step to fail. Consider installingjq
first or using a different approach for JSON manipulation.Copilot uses AI. Check for mistakes.