Notion Post Publisher #3646
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: Notion Post Publisher | |
on: | |
workflow_dispatch: {} | |
schedule: | |
- cron: "0 15-21 * * 1-5" | |
jobs: | |
Notion-Post-Publisher: | |
name: "Notion Post Publisher" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/cache@v2 | |
id: yarn-cache | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
if: steps.yarn-cache.outputs.cache-hit != 'true' | |
run: yarn install | |
- name: Process pending posts | |
run: | | |
cd www | |
npm run publish-posts | |
env: | |
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
AWS_BUCKET: ${{ secrets.AWS_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
TWITTER_BEARER_TOKEN: ${{ secrets.TWITTER_BEARER_TOKEN }} | |
- name: Run image generator | |
run: | | |
cd www | |
npm run generate-images | |
env: | |
AWS_BUCKET: ${{ secrets.AWS_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
title: "New Post(s) from Notion" | |
body: ":robot: This pull request was opened automatically by a GitHub Action after running the Notion post publisher script." | |
labels: "content,feature: blog" | |
commit-message: New post from Notion | |
branch: bot/notion-post-publisher | |
branch-suffix: timestamp |