Pull and commit data #45
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: Pull and commit data | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: 0 8 * * * | |
- cron: 0 0 * * 0 | |
- cron: 0 0 1 * * | |
jobs: | |
images: | |
if: github.event.schedule == '0 8 * * *' | |
needs: [] | |
name: update-images | |
runs-on: ubuntu-latest | |
env: | |
AZURE_SUBSCRIPTION_KEY: ${{secrets.AZURE_SUBSCRIPTION_KEY}} | |
ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}} | |
ALGOLIA_WRITE_API_KEY: ${{secrets.ALGOLIA_WRITE_API_KEY}} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: poetry | |
- run: poetry install | |
- name: pull bing images | |
run: | | |
poetry run python crawler/bing_daily_wallpaper.py | |
poetry run python crawler/bing_trending_images.py | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- run: | | |
pnpm install | |
pnpm lint:fix | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "skip_commit=false" >> $GITHUB_ENV | |
else | |
echo "skip_commit=true" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.skip_commit == 'false' | |
run: | | |
git config --global user.email "luz.liting@gmail.com" | |
git config --global user.name "litingyes" | |
git add . | |
git commit -m "chore(github-actions): update daily-wallpaper and trending-images at $(date +'%Y-%m-%d')" | |
git pull origin main -r | |
git push origin main | |
bing-search-images: | |
if: github.event.schedule == '0 0 * * 0' | |
name: update-bing-search-images | |
runs-on: ubuntu-latest | |
env: | |
AZURE_SUBSCRIPTION_KEY: ${{secrets.AZURE_SUBSCRIPTION_KEY}} | |
ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}} | |
ALGOLIA_WRITE_API_KEY: ${{secrets.ALGOLIA_WRITE_API_KEY}} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: poetry | |
- run: poetry install | |
- run: poetry run python crawler/bing_search_wallpaper.py | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- run: | | |
pnpm install | |
pnpm lint:fix | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "skip_commit=false" >> $GITHUB_ENV | |
else | |
echo "skip_commit=true" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.skip_commit == 'false' | |
run: | | |
git config --global user.email "luz.liting@gmail.com" | |
git config --global user.name "litingyes" | |
git add . | |
git commit -m "chore(github-actions): update bing search images at $(date +'%Y-%m-%d')" | |
git pull origin main -r | |
git push origin main | |
emojis: | |
if: github.event.schedule == '0 0 1 * *' | |
name: update-emojis | |
runs-on: ubuntu-latest | |
env: | |
ALGOLIA_APPLICATION_ID: ${{secrets.ALGOLIA_APPLICATION_ID}} | |
ALGOLIA_WRITE_API_KEY: ${{secrets.ALGOLIA_WRITE_API_KEY}} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
cache: poetry | |
- run: poetry install | |
- run: poetry run python crawler/emojis.py | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- run: | | |
pnpm install | |
pnpm lint:fix | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "skip_commit=false" >> $GITHUB_ENV | |
else | |
echo "skip_commit=true" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.skip_commit == 'false' | |
run: | | |
git config --global user.email "luz.liting@gmail.com" | |
git config --global user.name "litingyes" | |
git add . | |
git commit -m "chore(github-actions): update emojis at $(date +'%Y-%m-%d')" | |
git pull origin main -r | |
git push origin main |