Skip to content

default

default #209

Workflow file for this run

name: Fetch From Google Docs
on:
workflow_dispatch:
repository_dispatch:
jobs:
fetch:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
concurrency:
group: fetching
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest # or "latest", "canary", <sha>
# cache-dependency-path: package-lock.json
- name: Install Dependency
run: bun install
- name: Download files
run: bun ./scripts/docs-to-md.js
env:
GOOGLE_DOCS_ACCESS: ${{ secrets.GOOGLE_DOCS_ACCESS }}
GOOGLE_DOCS_REFRESH: ${{ secrets.GOOGLE_DOCS_REFRESH }}
GOOGLE_DOCS_CLIENT_ID: ${{ secrets.GOOGLE_DOCS_CLIENT_ID }}
GOOGLE_DOCS_CLIENT_SECRET: ${{ secrets.GOOGLE_DOCS_CLIENT_SECRET }}
- name: Rename files
run: "cd src/content/docs ;find ./ -type f | xargs sed -i 's/الترتيب/sidebar: \\n order/g' ;find ./ -type f | xargs sed -i 's/التاريخ/date/g' ;find ./ -type f | xargs sed -i 's/الملخص/excerpt/g' ;find ./ -type f | xargs sed -i 's/الأقسام/tags/g' ;find ./ -type f | xargs sed -i 's/آخر تعديل/lastUpdated/g' ;find ./ -type f | xargs sed -i 's/مسودة/draft: true/g' ;find ./ -type f | xargs sed -i 's/++/`/g';find ./ -type f | xargs sed -i 's/\\*\\*\\*/---/g' ; find ./ -type f | xargs sed -i 's/#انتهى السؤال/<\\/Question>/g'; find ./ -type f | xargs sed -i 's/#سؤال/<Question>\\n /g'; find ./ -type f | xargs sed -i 's/#انتهى المثال/<\\/Example>/g'; find ./ -type f | xargs sed -i 's/#مثال/<Example>\\n /g'; find ./ -type f | xargs sed -i 's/#انتهى النص/<\\/Quote>/g'; find ./ -type f | xargs sed -i 's/#نص/<Quote>\\n /g'; find ./ -type f | xargs sed -i 's/{/\\\\{/g' ; find ./ -type f | xargs sed -i 's/}/\\\\}/g'"
- name: Commit new data
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update Google Docs files"
commit_user_name: GitHub Actions
commit_user_email: [email protected]
commit_author: GitHub Actions <[email protected]>