Daily Update #5
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: Daily Update | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
update_and_commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run update script | |
run: python main.py | |
- name: Check for updates | |
id: check_updates | |
run: | | |
if [ -f updated_categories.txt ]; then | |
echo "updates_found=true" >> $GITHUB_ENV | |
UPDATED_CATEGORIES=$(cat updated_categories.txt | tr '\n' ', ' | sed 's/, $//') | |
rm updated_categories.txt | |
echo "updated_categories=${UPDATED_CATEGORIES}" >> $GITHUB_ENV | |
else | |
echo "updates_found=false" >> $GITHUB_ENV | |
fi | |
- name: Commit | |
if: env.updates_found == 'true' | |
uses: qoomon/actions--create-commit@v1 | |
with: | |
message: $(date +'%Y-%m-%d') Updated ${{ env.updated_categories }} | |
skip-empty: true | |
token: ${{ secrets.ACTION_TOKEN }} | |
- name: Push | |
if: ${{ steps.commit.outputs.commit }} | |
run: git push |