-
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.
- Loading branch information
Showing
1 changed file
with
23 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,23 @@ | ||
name: Push to GitLab | ||
on: push | ||
jobs: | ||
push_gitlab: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # 确保获取完整的仓库历史 | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name "GitHub Action" | ||
git config --global user.email "action@github.com" | ||
- name: Push to GitLab | ||
run: | | ||
# 使用 HTTPS URL 和 PAT | ||
git remote add gitlab https://Elflare:${{ secrets.GITLAB_TOKEN }}@gitlab.com/Elflare/zrlong.git | ||
git fetch gitlab | ||
git push gitlab HEAD:main --force # 强制推送到GitLab的main分支 | ||
env: | ||
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} # 使用秘密环境变量 |