Some checks failed
Download and Push File / download-and-push (push) Failing after 35s
39 lines
1.0 KiB
YAML
39 lines
1.0 KiB
YAML
name: Download and Push File
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
download-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# 1. 检出仓库
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
token: ${{ secrets.GITEA_TOKEN }} # 或使用 ${{ github.token }}
|
|
|
|
# 2. 配置 Git
|
|
- name: Configure Git
|
|
run: |
|
|
git config --local user.email "action@gitea.local"
|
|
git config --local user.name "Gitea Action"
|
|
|
|
# 3. 下载文件(示例)
|
|
- name: Download file
|
|
run: |
|
|
curl -o downloaded_file.txt https://example.com/file.txt
|
|
# 或者使用 wget
|
|
# wget https://example.com/file.txt -O downloaded_file.txt
|
|
|
|
# 4. 添加文件到 Git
|
|
- name: Add file to git
|
|
run: |
|
|
git add downloaded_file.txt
|
|
git commit -m "Add downloaded file via workflow"
|
|
|
|
# 5. 推送到仓库
|
|
- name: Push changes
|
|
run: |
|
|
git push origin main |