Skip to content

Commit

Permalink
chore: improve git-sync workflow by installing Git with -y flag and u…
Browse files Browse the repository at this point in the history
…sing global config for user settings
  • Loading branch information
iamvikshan committed Nov 18, 2024
1 parent 18a3058 commit cbf9d07
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/git-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Install latest Git
run: |
sudo apt-get update
sudo apt-get install git
sudo apt-get install -y git
- name: Checkout GitHub repository
uses: actions/checkout@v4
Expand All @@ -26,21 +26,19 @@ jobs:

- name: Configure Git
run: |
git config user.name "vixshan"
git config user.email "[email protected]"
git config --global user.name "vixshan"
git config --global user.email "[email protected]"
git config --global http.version HTTP/1.1
- name: Add GitLab remote
run: |
git remote add gitlab https://oauth2:${GITLAB_TOKEN}@gitlab.com/vikshan/amina.git
git remote add gitlab https://oauth2:${{ secrets.GITLAB_TOKEN }}@gitlab.com/vikshan/amina.git
- name: Fetch and sync with GitLab
run: |
git fetch gitlab
git push -f gitlab refs/remotes/origin/*:refs/heads/*
git push -f gitlab --tags
git pull gitlab --allow-unrelated-histories || true
git push https://${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git --all
git push https://${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git --tags
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
git push https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git --all
git push https://${{ secrets.GH_TOKEN }}@github.com/${{ github.repository }}.git --tags

0 comments on commit cbf9d07

Please sign in to comment.