forked from saiteja-madha/discord-js-bot
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add GitHub Actions workflow for syncing with GitLab
- Loading branch information
1 parent
64621f3
commit 07771a6
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Sync Repositories | ||
|
||
on: | ||
# Trigger on pushes to all branches | ||
push: | ||
branches: | ||
- '**' | ||
# Trigger on pull request events | ||
pull_request: | ||
types: [opened, closed] | ||
# Allow manual trigger | ||
workflow_dispatch: | ||
# Run on a schedule (every 6 hours) to catch GitLab changes | ||
schedule: | ||
- cron: '0 */6 * * *' | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout GitHub repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "vixshan" | ||
git config user.email "[email protected]" | ||
- name: Add GitLab remote | ||
run: | | ||
git remote add gitlab https://oauth2:${GITLAB_TOKEN}@gitlab.com/vikshan/amina.git | ||
- name: Fetch and sync with GitLab | ||
run: | | ||
# Fetch all branches and tags from GitLab | ||
git fetch gitlab | ||
# Push all GitHub branches to GitLab | ||
git push -f gitlab refs/remotes/origin/*:refs/heads/* | ||
# Push all tags to GitLab | ||
git push -f gitlab --tags | ||
# Pull changes from GitLab and push to GitHub | ||
git pull gitlab --allow-unrelated-histories || true | ||
git push origin --all | ||
git push origin --tags | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} |