From ea51ab1b36443ee37a3ea43ddb507cf846f32f56 Mon Sep 17 00:00:00 2001 From: SomeTechyGuy <159185930+SomeTechyGuy@users.noreply.github.com> Date: Wed, 12 Jun 2024 10:17:06 -0400 Subject: [PATCH] Update update_readme.yml --- .github/workflows/update_readme.yml | 41 +++-------------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/.github/workflows/update_readme.yml b/.github/workflows/update_readme.yml index ce208a8..018c367 100644 --- a/.github/workflows/update_readme.yml +++ b/.github/workflows/update_readme.yml @@ -3,8 +3,7 @@ name: Update README with jsdelivr content on: push: branches: - - main # Trigger on pushes to the main branch - workflow_dispatch: # Allows manual triggering + - main jobs: update-readme: @@ -20,38 +19,6 @@ jobs: - name: Update README.md run: | - node -e " - const fs = require('fs'); - - // Read the content from the file - const content = fs.readFileSync('content.txt', 'utf8'); - - // Read the existing README.md content - let readme = fs.readFileSync('README.md', 'utf8'); - - // Find the markers in the README.md content - const startMarker = ''; - const endMarker = ''; - const startIndex = readme.indexOf(startMarker); - const endIndex = readme.indexOf(endMarker) + endMarker.length; - - if (startIndex === -1 || endIndex === -1) { - throw new Error('Markers not found in README.md'); - } - - // Update the README.md content between the markers - readme = readme.substring(0, startIndex) + startMarker + '\n```plaintext\n' + content + '\n```\n' + readme.substring(endIndex); - - // Write the updated content back to README.md - fs.writeFileSync('README.md', readme); - " - - - name: Commit and push changes - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email 'github-actions[bot]@users.noreply.github.com' - git add README.md - git commit -m "Update README with jsdelivr content" - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + sed -i '//,//d' README.md + sed -i '//r content.txt' README.md + sed -i '//a\n```' README.md