Create Daily Markdown File #117
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: Create Daily Markdown File | |
on: | |
schedule: | |
- cron: '1 15 * * *' # UTCで15時1分 (日本時間で24時1分) | |
workflow_dispatch: | |
jobs: | |
create_markdown: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Create Markdown File | |
run: | | |
YEAR=$(date -d "+9 hours" +'%Y') # UTCをJSTに変換してから年を取得 | |
FOLDER=$(date -d "+9 hours" +'%Y_%m') # UTCをJSTに変換してから年_月を取得 | |
TODAY=$(date -d "+9 hours" +'%Y/%m/%d') # UTCをJSTに変換してから日付を取得 | |
FILENAME=$(date -d "+9 hours" +'%Y%m%d').md # UTCをJSTに変換してからファイル名を取得 | |
mkdir -p ${{ github.workspace }}/$YEAR/$FOLDER | |
cp TIDmd_temple.md ${{ github.workspace }}/$YEAR/$FOLDER/$FILENAME | |
sed -i "s|YYYY/MM/DD|$TODAY|" ${{ github.workspace }}/$YEAR/$FOLDER/$FILENAME | |
- name: Push to repository | |
run: | | |
git config --local user.email ${{ secrets.SECRETUSEREMAIL }} | |
git config --local user.name ${{ secrets.SECRETUSERNAME }} | |
git add . | |
git commit -m "Create daily markdown file for $(date -d "+9 hours" +'%Y%m%d')" | |
git push |