Execute script and push changes #7976
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
name: Execute script and push changes | |
on: | |
push: | |
schedule: | |
- cron: '0 * * * *' # Runs every hour | |
env: | |
GITHUB_TOKEN: ${{ secrets.REDBOT_GITHUB_TOKEN }} # Specify your token here | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags. | |
- name: Execute script | |
run: | | |
chmod +x ./script.sh | |
./script.sh | |
- name: Commit and push if it has changed | |
run: | | |
git config --global user.email "3293172751ysy@gmail.com" | |
git config --global user.name "openimbot" | |
git diff --quiet && git diff --staged --quiet || (git add .; git commit -m "Auto update from Github Action"; git push origin main;) |