.github/workflows/update-output.yaml #66
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
# Auto Run and Commit | |
name: Update Output | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
run_and_commit: | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.20' # 替换为你希望使用的Go版本 | |
- name: Install dependencies | |
run: go mod tidy | |
- name: Run go run . | |
run: go run . | |
- name: Check for changes | |
id: check_changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "CHANGES=true" >> $GITHUB_ENV | |
fi | |
- name: Commit changes | |
if: env.CHANGES == 'true' | |
uses: stefanzweifel/git-auto-commit-action@v4 |