Skip to content

Commit

Permalink
add git fetch action
Browse files Browse the repository at this point in the history
  • Loading branch information
Casxt committed Mar 10, 2024
1 parent b1932f9 commit a704124
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/fetch-dmhy-rss-perodically.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
schedule:
- cron: "0 */2 * * *"
workflow_dispatch:
inputs:
commit_message:
description: 'commit message'
required: true
default: 'manually fetch rss'
permissions:
contents: write

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "25.3"
- name: Generage Protobuf
run: ./generage_proto.sh
- name: Fetch RSS
run: python src/fetch_share_dmhy_org.py
- name: Check updates
run: |
if [[ -z $(git status --porcelain) ]]; then
echo "no updates"
exit
else
echo "check updates successful"
fi
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "${{inputs.commit_message}}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}

0 comments on commit a704124

Please sign in to comment.