VYP Edited flyGPSMission.py #26
Workflow file for this run
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: Sync to Main | |
on: | |
push: | |
branches: | |
- 'services/**' | |
jobs: | |
sync: | |
if: github.ref_name != 'main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
path: source | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
path: main | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sync to main | |
run: | | |
SERVICE_PATH="${{ github.ref_name }}" | |
cd main | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
# Remove old service directory | |
rm -rf "$SERVICE_PATH" | |
# Copy files from source to service directory | |
mkdir -p "$SERVICE_PATH" | |
cp -r ../source/* "$SERVICE_PATH/" 2>/dev/null || true | |
cp -r ../source/.[^.]* "$SERVICE_PATH/" 2>/dev/null || true | |
# Remove .git directory if copied | |
rm -rf "$SERVICE_PATH/.git" | |
git add . | |
if ! git diff --staged --quiet; then | |
git commit -m "Update $SERVICE_PATH" | |
git push origin main | |
fi |