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
10 changes: 10 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ jobs:
cat .gitmodules
make build

- name: Clone wire-server and `make sanitize-pr`
# if this fails, you need to run it on your PR and commit the changes it makes.
run: |
CURRENT_REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git"
BRANCH_NAME=${GITHUB_REF##*/}
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

Using ${GITHUB_REF##*/} will produce 'merge' for pull_request refs like refs/pull/123/merge, causing the subsequent clone to target a non-existent branch. Prefer GITHUB_HEAD_REF when the event is pull_request, falling back to GITHUB_REF for push events, e.g.: BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}".

Suggested change
BRANCH_NAME=${GITHUB_REF##*/}
BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"

Copilot uses AI. Check for mistakes.


git clone --branch develop "$CURRENT_REPO_URL" wire-server -b "$BRANCH_NAME"
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

The git clone command passes a second -b/--branch option after the destination directory, which git interprets as an extra argument and will fail (e.g. "fatal: repository '-b' does not exist"). Use a single --branch before the repo URL, or implement an explicit fallback. Example: git clone --branch "$BRANCH_NAME" "$CURRENT_REPO_URL" wire-server || git clone --branch develop "$CURRENT_REPO_URL" wire-server (with cleanup as needed).

Suggested change
git clone --branch develop "$CURRENT_REPO_URL" wire-server -b "$BRANCH_NAME"
# Try to clone with the PR branch, fall back to develop if it doesn't exist
if ! git clone --branch "$BRANCH_NAME" "$CURRENT_REPO_URL" wire-server; then
rm -rf wire-server
git clone --branch develop "$CURRENT_REPO_URL" wire-server
fi

Copilot uses AI. Check for mistakes.

cd wire-server
make sanitize-pr

Comment on lines +41 to +50
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

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

This step reclones the same repository that has already been checked out earlier in the job, adding unnecessary network and I/O cost. You can run make sanitize-pr directly in the existing workspace (remove clone/cd) unless isolation is required; if isolation is needed, add a shallow clone (e.g. --depth 1) and fix the branch logic as noted.

Suggested change
- name: Clone wire-server and `make sanitize-pr`
# if this fails, you need to run it on your PR and commit the changes it makes.
run: |
CURRENT_REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git"
BRANCH_NAME=${GITHUB_REF##*/}
git clone --branch develop "$CURRENT_REPO_URL" wire-server -b "$BRANCH_NAME"
cd wire-server
make sanitize-pr
- name: Run `make sanitize-pr`
# if this fails, you need to run it on your PR and commit the changes it makes.
run: |
make sanitize-pr

Copilot uses AI. Check for mistakes.

# tasks to update the submodule reference in wire-docs repo are yet to be added