DO NOT MERGE: Job verification #22
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
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="https://github.com/${{ vars.TARGET_REPO }}.git" | |
REPO_URL="${REPO_URL%/}" | |
# Set the target repository as origin (like CodeBuild does) | |
git remote set-url origin "$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 }}@github.com/${{ vars.TARGET_REPO }}.git" "$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 }}" |