Test Push #2
This file contains hidden or 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
name: Test Push | |
on: | |
workflow_dispatch: | |
jobs: | |
test-push: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 创建测试文件 | |
run: | | |
echo "test $(date)" > test.txt | |
- name: 配置 Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: 检查变更并提交 | |
run: | | |
git add test.txt | |
git diff --cached --quiet || git commit -m "test: 测试自动推送权限" | |
- name: 推送变更 | |
run: | | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
git push origin main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |