Skip to content

Commit

Permalink
Create main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Elflare committed Apr 30, 2024
1 parent c062cb9 commit e1e7b54
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/main.yml
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 }} # 使用秘密环境变量

0 comments on commit e1e7b54

Please sign in to comment.