-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-push-github.yml
More file actions
33 lines (26 loc) · 964 Bytes
/
Copy pathtest-push-github.yml
File metadata and controls
33 lines (26 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
trigger: none
pool:
name: 'rd2-build-pool'
demands:
- Agent.Name -equals 112_win_python_build
variables:
- group: GithubSecrets # 包含 GITHUB_PAT 和 GITHUB_USER_NAME 的变量组
jobs:
- job: TestPushGithub
displayName: '测试使用 PAT 推送到 GitHub'
steps:
- checkout: self
clean: true
fetchDepth: 0
path: s/test1
- script: |
@echo off
cd /d "$(Build.SourcesDirectory)"
echo 正在推送到 GitHub...
:: --force 用于覆盖 GitHub 上的初始提交(如空仓库有 README 等)
:: 若 GitHub 仓库完全为空(0 commits),可去掉 --force
git push --force https://%GITHUB_USER_NAME%:%GITHUB_PAT%@github.com/DMGithubPublisher/test1.git HEAD:main
displayName: '同步推送到 GitHub'
env:
GITHUB_PAT: $(GITHUB_PAT)
GITHUB_USER_NAME: $(GITHUB_USER_NAME)