Daily Fetch and Update #9262
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 Fetch and Update | |
on: | |
push: | |
branches: | |
- master | |
- main | |
schedule: | |
- cron: '0 */1 * * *' | |
permissions: | |
contents: write | |
jobs: | |
fetch_and_update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Fetch events | |
run: python update.py | |
- name: Convert JSON to Markdown | |
run: python json_to_md.py | |
- name: Check for changes | |
id: check_changes | |
run: | | |
git add . | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "CHANGES=true" >> $GITHUB_ENV | |
fi | |
- name: webhook | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.WEBHOOK }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
-H "User-Agent: Webhook" \ | |
https://api.github.com/repos/ProbiusOfficial/Hello-CTF/dispatches \ | |
-d '{"event_type":"Hello-CTFTime","client_payload":{"unit":false,"integration":true}}' | |
- name: Commit and push changes | |
if: env.CHANGES == 'true' | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Automatically update |