-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
61 additions
and
102 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,27 @@ | ||
name: 'Git Repo Sync' | ||
description: 'Git Repo Sync enables you to synchronize code to other code management platforms, such as GitLab, Gitee, etc.' | ||
|
||
branding: | ||
icon: upload-cloud | ||
color: gray-dark | ||
|
||
inputs: | ||
target-url: | ||
description: 'Target Repo URL' | ||
required: true | ||
target-username: | ||
description: 'Target Repo Username' | ||
required: true | ||
target-token: | ||
description: 'Target Token' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: ${{ github.action_path }}/entrypoint.sh | ||
shell: bash | ||
env: | ||
INPUT_TARGET_URL: ${{ inputs.target-url }} | ||
INPUT_TARGET_USERNAME: ${{ inputs.target-username }} | ||
INPUT_TARGET_TOKEN: ${{ inputs.target-token }} | ||
GITHUB_EVENT_REF: ${{ github.event.ref }} |
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,14 @@ | ||
git remote add target https://${INPUT_TARGET_USERNAME}:${INPUT_TARGET_TOKEN}@${INPUT_TARGET_URL#https://} | ||
|
||
case "${GITHUB_EVENT_NAME}" in | ||
push) | ||
git push -f --all target | ||
git push -f --tags target | ||
;; | ||
delete) | ||
git push -d target ${GITHUB_EVENT_REF} | ||
;; | ||
*) | ||
break | ||
;; | ||
esac |
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,19 @@ | ||
name: GitlabSync | ||
|
||
on: | ||
- push | ||
- delete | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
name: Git Repo Sync | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./.github/actions/git-repo-sync | ||
with: | ||
target-url: ${{ secrets.TARGET_URL }} | ||
target-username: ${{ secrets.TARGET_USERNAME }} | ||
target-token: ${{ secrets.TARGET_TOKEN }} |
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