Skip to content

post

post #168

Workflow file for this run

name: post
on:
push:
branches:
- master
schedule:
- cron: "0 4 * * 1" # every monday 13:00 JST
workflow_dispatch:
jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
- name: update weekly menu
run: |
cd ./gen_weekly
go run main.go
env:
SA_JSON: ${{ secrets.SA_JSON }}
TW_CS: ${{ secrets.TW_CS }}
TW_CK: ${{ secrets.TW_CK }}
TW_AT: ${{ secrets.TW_AT }}
TW_ATS: ${{ secrets.TW_ATS }}
- name: Save menu name
id: menu
run: |
echo "nine=$(git diff -U0 | grep '週代わり定食9番' | cut -d',' -f2 | head -n1)" >> $GITHUB_OUTPUT
echo "fifteen=$(git diff -U0 | grep '週代わり定食15番' | cut -d',' -f2 | tail -n1)" >> $GITHUB_OUTPUT
- name: Commit files
run: |
git add weekly.csv
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "[ci skip] auto commit, generate weekly menu"
if: ${{ steps.menu.outputs.nine != '' }}
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
if: ${{ steps.menu.outputs.nine != '' }}
- name: Tweet change
uses: snow-actions/[email protected]
env:
CONSUMER_API_KEY: ${{ secrets.TW_CK }}
CONSUMER_API_SECRET_KEY: ${{ secrets.TW_CS }}
ACCESS_TOKEN: ${{ secrets.TW_AT }}
ACCESS_TOKEN_SECRET: ${{ secrets.TW_ATS }}
with:
status: |
週替わり定食を更新しました!
9番 ${{ steps.menu.outputs.nine }}
15番 ${{ steps.menu.outputs.fifteen }}
https://github.com/shokujinjp/data #今日の食神
if: ${{ steps.menu.outputs.nine != '' }}
- uses: whywaita/slatify@add-any-fields
if: always()
with:
job_name: '*scrape shokujinjp weekly menu*'
type: ${{ job.status }}
icon_emoji: ':shokujin_icon:'
username: 'shokujinjp [bot]'
url: ${{ secrets.SLACK_WEBHOOK_URL }}
token: ${{ secrets.GITHUB_TOKEN }}
more_fields: '{"9番": "${{ steps.menu.outputs.nine }}", "15番": "${{ steps.menu.outputs.fifteen }}"}'