-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fetch & process with github action instead
- Loading branch information
Showing
6 changed files
with
279 additions
and
203 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Fetch Second Brain | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
fetch-second-brain: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
# Pnpm | ||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 8 | ||
run_install: false | ||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Fetch Second Brain | ||
run: pnpm run fetch-second-brain | ||
|
||
- name: Commit changes | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "narze's bot" | ||
# Check if there are any changes | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
# Get list of changed files | ||
CHANGED_FILES=$(git status --porcelain | awk '{print $2}' | sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/, /g' -e 's/, $//') | ||
# Commit changes | ||
git add -A | ||
git commit -m "Updated: $CHANGED_FILES" | ||
# Push changes | ||
git push | ||
else | ||
echo "No changes to commit" | ||
fi |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { | ||
fetchSecondBrain, | ||
postProcess, | ||
} from "./src/lib/github-fetch-integration" | ||
;(async () => { | ||
await fetchSecondBrain() | ||
await postProcess() | ||
})() |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.