Skip to content

ci(l1,l2): lines of code report #3764

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

Merged
merged 18 commits into from
Jul 24, 2025
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
21 changes: 19 additions & 2 deletions .github/workflows/pr_loc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,27 @@ jobs:
# Skip the job if the PR is from a fork since it doesn't have permissions to post comments
if: github.event.pull_request.head.repo.fork == false
steps:
- name: Checkout Base
- name: Checkout PR Code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Find merge base
id: find_merge_base
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
git fetch --depth=100000 origin $HEAD_REF
git fetch --depth=100000 origin $BASE_REF
MERGE_BASE=$(git merge-base origin/$HEAD_REF origin/$BASE_REF)
Copy link
Preview

Copilot AI Jul 22, 2025

Choose a reason for hiding this comment

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

The git merge-base command could fail if the branches don't share common history or if the fetch operations didn't retrieve sufficient commits. Add error handling to check if the merge base was found successfully.

Suggested change
MERGE_BASE=$(git merge-base origin/$HEAD_REF origin/$BASE_REF)
MERGE_BASE=$(git merge-base origin/$HEAD_REF origin/$BASE_REF || echo "")
if [ -z "$MERGE_BASE" ]; then
echo "Error: Unable to find a merge base between $HEAD_REF and $BASE_REF." >&2
exit 1
fi

Copilot uses AI. Check for mistakes.

echo "merge_base=$MERGE_BASE" >> $GITHUB_OUTPUT

- name: Checkout merge base commit
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ steps.find_merge_base.outputs.merge_base }}

- name: Setup Rust Environment
uses: ./.github/actions/setup-rust
Expand Down