Skip to content

Commit

Permalink
fix: update notion workflow with envvars and error checking logic
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsathiya committed Aug 26, 2024
1 parent bdc386b commit 14186b5
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/notion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

jobs:
commit:
runs-on: ubuntu-24.04
runs-on: ubuntu-latest
env:
TZ: 'America/Los_Angeles'
permissions:
Expand All @@ -37,8 +37,20 @@ jobs:
env:
NOTION_SECRET: ${{ secrets.NOTION_SECRET }}
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }}
with:
cmd: notion-to-md
continue-on-error: true

- name: Check for script errors
run: |
if [ $? -ne 0 ]; then
echo "Notion script failed. Check the logs for errors."
exit 1
fi
- name: Fix Formatting
uses: borales/actions-yarn@v5
Expand All @@ -48,12 +60,22 @@ jobs:
- name: Stage all changes
run: |
git add .
git diff --staged --quiet || echo "CHANGES_EXIST=true" >> $GITHUB_ENV
- name: Commit Changes
if: env.CHANGES_EXIST == 'true'
uses: planetscale/ghcommit-action@v0.1.33
with:
commit_message: ${{ github.event.inputs.commit_message || 'Update from Notion' }}
repo: ${{ github.repository }}
branch: ${{ github.head_ref || github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check for commit errors
if: env.CHANGES_EXIST == 'true'
run: |
if [ $? -ne 0 ]; then
echo "Failed to commit changes. Check the logs for errors."
exit 1
fi

1 comment on commit 14186b5

@vercel
Copy link

@vercel vercel bot commented on 14186b5 Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

portfolio – ./

portfolio-git-main-arun-s.vercel.app
portfolio-arun-s.vercel.app
www.arun.blog
arun.blog

Please sign in to comment.