diff --git a/.github/workflows/action.yaml b/.github/workflows/generate-related.yaml similarity index 59% rename from .github/workflows/action.yaml rename to .github/workflows/generate-related.yaml index d776405e57..5f0f792ee6 100644 --- a/.github/workflows/action.yaml +++ b/.github/workflows/generate-related.yaml @@ -3,7 +3,7 @@ name: Generate Read More related on: push: branches: - - automate-read-more + - gh-pages pull_request: branches: - gh-pages @@ -22,4 +22,11 @@ jobs: - run: npm install - run: npm run compute-embeddings --OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - run: npm run generate-related - - uses: stefanzweifel/git-auto-commit-action@v5 \ No newline at end of file + - name: Create New Pull Request + if: steps.calibre.outputs.markdown != '' + uses: peter-evans/create-pull-request@v4 + with: + title: Auto Compressed Images + branch-suffix: timestamp + commit-message: Auto Compressed Images + body: ${{ steps.calibre.outputs.markdown }} \ No newline at end of file diff --git a/scripts/generate-related/blog-metadata.mjs b/scripts/generate-related/blog-metadata.mjs index bccdf7a415..25e02d973a 100644 --- a/scripts/generate-related/blog-metadata.mjs +++ b/scripts/generate-related/blog-metadata.mjs @@ -44,7 +44,7 @@ data.forEach((d, i) => { - ${filenameToUrl(sortedDistances[0].item.file)} - ${filenameToUrl(sortedDistances[1].item.file)}`; - fs.appendFileSync("./_data/related.yml", output + "\n"); + fs.writeFileSync("./_data/related.yml", output + "\n"); } }); diff --git a/scripts/generate-related/compute-embeddings.js b/scripts/generate-related/compute-embeddings.js index 58c38bc608..45e5982f6d 100644 --- a/scripts/generate-related/compute-embeddings.js +++ b/scripts/generate-related/compute-embeddings.js @@ -49,8 +49,7 @@ const summarisePost = async (post) => { }; (async () => { - console.log(process.cwd()); - const paths = await glob("./_posts/**/2023-*.*").then((paths) => { + const paths = await glob("./_posts/**/*.*").then((paths) => { return paths; });