Skip to content

Commit

Permalink
scripts: fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
nitnelave committed Apr 11, 2023
1 parent 4631126 commit b48a52f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/scripts/rss.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
# Update the README.md file
client = Octokit::Client.new(:access_token => ENV['GITHUB_TOKEN'])
repo = ENV['GITHUB_REPOSITORY']
print(ENV['GITHUB_TOKEN'][0..5])
readme = client.readme(repo)
readme_content = Base64.decode64(readme[:content]).force_encoding('UTF-8')

readme_content = File.read("README.md")

# Replace the existing blog posts section
posts_regex = /### Latest posts\n\n[\s\S]*?(?=<\/td>)/m
posts_regex = /### Latest posts\n\n.*/m
updated_content = readme_content.sub(posts_regex, "#{posts_list.join("\n")}\n")

client.update_contents(repo, 'README.md', 'Update latest blog posts', readme[:sha], updated_content)

0 comments on commit b48a52f

Please sign in to comment.