Update if python files have updated #14
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: Update if python files have updated | |
on: | |
schedule: | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
update: | |
name: Check for updates | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Download newest files | |
run: | | |
echo "Downloading new files from Argon40 download server" | |
./update.sh | |
- name: Check for changes in files | |
id: check_changes | |
run: | | |
# Check for any changes in the src directory | |
if git diff --quiet src; then | |
echo "No changes detected in src directory." | |
echo "changed=false" >> $GITHUB_ENV | |
else | |
echo "Changes detected in src directory." | |
echo "changed=true" >> $GITHUB_ENV | |
# Capture the diff to include in the PR body | |
git diff src > changes.diff | |
fi | |
- name: Create Pull Request | |
if: env.changed == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
branch: bot/update | |
delete-branch: true | |
commit-message: "Auto-update: files have changed" | |
title: "Auto-update: files have changed" | |
body: | | |
This PR was created automatically by a scheduled GitHub Action. | |
Here are the changes made: | |
``` | |
$(cat changes.diff) | |
``` |