RSS Feed Check #1639
This file contains hidden or 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: RSS Feed Check | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # Allow manual triggering | |
schedule: | |
# Run every hour between 7am-10pm | |
- cron: '0 7-22 * * *' | |
permissions: | |
contents: write | |
jobs: | |
check-feeds: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Run RSS feed manager | |
run: | | |
set -e # Exit immediately if a command exits with a non-zero status | |
go run cmd/main.go | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
- name: Commit state changes | |
if: success() | |
run: | | |
git config --global user.name 'GitHub Action' | |
git config --global user.email 'action@github.com' | |
git add state.json | |
# Only commit and push if there are changes | |
if ! git diff --staged --quiet; then | |
git commit -m 'chore: update feed state' | |
git push | |
else | |
echo "No changes to commit" | |
fi |