Skip to content

DO NOT MERGE: Job verification #20

DO NOT MERGE: Job verification

DO NOT MERGE: Job verification #20

name: Mirror Repository
on:
pull_request:
branches:
- main
# Concurrency control to prevent parallel runs
concurrency:
group: premerge-mirror-verification-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
mirror-repository:
runs-on: self-hosted
container:
image: docker:dind
timeout-minutes: 30
# Only run on specific repository and specific PRs
if: github.repository == 'isaac-sim/IsaacLab' && github.event.pull_request.base.ref == 'main'
environment:
name: mirror-production
url: https://github.com/${{ vars.TARGET_REPO }}
steps:
- name: Install Git LFS
run: |
apk update
apk add --no-cache git-lfs
git lfs install
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Configure Git
run: |
git config --global user.name "Isaac LAB CI Bot"
git config --global user.email "isaac-lab-ci-bot@nvidia.com"
- name: Mirror to Target Repository
run: |
git config --global --add safe.directory ${{ github.workspace }}
git config --global --add safe.directory .
# Test different repository name variations
echo "🔍 Testing repository access..."
# Test the current repository name
REPO_URL="github.com/${{ vars.TARGET_REPO }}.git"
REPO_URL="${REPO_URL%/}"
echo "Testing: $REPO_URL"
# Test if we can access the repository
if git ls-remote "https://${{ secrets.GH_TOKEN }}@${REPO_URL}" 2>/dev/null; then
echo "✅ Repository accessible: $REPO_URL"
else
echo "❌ Repository not accessible: $REPO_URL"
# Try without .git extension
REPO_URL_NO_GIT="${REPO_URL%.git}"
echo "Testing without .git: $REPO_URL_NO_GIT"
if git ls-remote "https://${{ secrets.GH_TOKEN }}@${REPO_URL_NO_GIT}.git" 2>/dev/null; then
echo "✅ Repository accessible without .git: $REPO_URL_NO_GIT"
REPO_URL="${REPO_URL_NO_GIT}.git"
else
echo "❌ Repository still not accessible"
# List repositories in the organization to find the correct name
echo "🔍 Listing repositories in isaac-sim organization..."
curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/orgs/isaac-sim/repos?per_page=50" 2>/dev/null | \
grep '"name"' | cut -d'"' -f4 | sort | grep -i "isaac\|lab\|internal" | head -10
exit 1
fi
fi
# Set the target repository as origin (like CodeBuild does)
git remote set-url origin "https://github.com/${REPO_URL}"
# Create PR branch name for verification
PR_BRANCH_NAME="pr-${{ github.event.number }}-${{ github.head_ref }}"
# Create a temporary branch with the PR changes
git checkout -b $PR_BRANCH_NAME
# Push the temporary branch to the target repository for verification
git push --force "https://${{ secrets.GH_TOKEN }}@${REPO_URL}" "$PR_BRANCH_NAME"
echo "✅ Successfully pushed PR verification branch to ${{ vars.TARGET_REPO }}:$PR_BRANCH_NAME"
echo "PR Number: ${{ github.event.number }}"
echo "PR Head Branch: ${{ github.head_ref }}"