Skip to content

Restrict copybara workflow to main repository (#85) #20

Restrict copybara workflow to main repository (#85)

Restrict copybara workflow to main repository (#85) #20

Workflow file for this run

name: Sync to Target Repos (Copybara)
on:
push:
branches:
- main
paths:
- 'examples/stage1/**'
- 'examples/LICENSE'
- 'copy.bara.sky'
- '.github/workflows/copybara.yml'
jobs:
copybara:
if: github.ref == 'refs/heads/main' && github.repository == 'frcsoftware/frcsoftware.org'
runs-on: ubuntu-latest
strategy:
# Run the workflows in parallel
fail-fast: false
matrix:
workflow:
- rev_solution
- ctre_solution
- rev_template
- ctre_template
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Configure Git Auth
run: |
# Set global git user for commits
git config --global user.name "Automated Sync"
git config --global user.email "noreply@frcsoftware.org"
# Configure git to use your PAT for all HTTPS connections to GitHub
git config --global url."https://x-access-token:${{ secrets.COPYBARA_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Download Copybara
run: wget https://github.com/google/copybara/releases/download/v20260629/copybara_deploy.jar
- name: Run Copybara
# Copybara uses exit code 4 to indicate a no-op (no files were updated).
# We catch this and treat it as success so the workflow doesn't fail.
run: java -jar copybara_deploy.jar copy.bara.sky ${{ matrix.workflow }} --force --ignore-noop || test $? -eq 4