Update daily.yml #10
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: Scrape and Update README | |
on: | |
schedule: | |
# - cron: '0 12 * * *' # Menjalankan setiap hari pada pukul 5 pagi GMT/7 | |
- cron: '5 0 * * *' | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository content | |
uses: actions/checkout@v4 # Checkout the repository content to github runner. | |
- name: Setup Python Version | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 # Install the python version needed | |
- name: Install Python dependencies | |
run: python -m pip install --upgrade pip requests beautifulsoup4 | |
- name: Execute Python script # Run the run.py to get the latest data | |
run: python main.py | |
- name: Check if there are any changes | |
id: verify_diff | |
run: | | |
git add . | |
if git diff-index --quiet HEAD --; then | |
echo "changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Commit | |
if: steps.verify_diff.outputs.changed == 'true' | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Update Daily Devotional" | |
- name: Push | |
if: steps.verify_diff.outputs.changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
branch: ${{ github.ref }} |