VYP: Edited workflow sync file #21
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: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Sync to main | |
run: | | |
SERVICE_PATH="${{ github.ref_name }}" | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout main | |
git pull origin main | |
git checkout ${{ github.ref_name }} -- . | |
mkdir -p "$SERVICE_PATH" | |
cp -r . "$SERVICE_PATH/" | |
rm -rf "$SERVICE_PATH/.git" | |
git add "$SERVICE_PATH/" | |
if ! git diff --staged --quiet; then | |
git commit -m "Update $SERVICE_PATH" | |
git push origin main | |
fi |