This commit is contained in:
parent
1b626d6389
commit
e3e5906be1
28
.gitea/workflows/validate-on-push.yml
Normal file
28
.gitea/workflows/validate-on-push.yml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: Validate on Push
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
completion_pct: ${{ steps.run_koans.outputs.completion_pct }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: ruby/setup-ruby@v1
|
||||||
|
with:
|
||||||
|
ruby-version: '3.1.4'
|
||||||
|
bundler-cache: true
|
||||||
|
- id: run_koans
|
||||||
|
run: |
|
||||||
|
bundle exec rake | tee output.txt
|
||||||
|
echo "completion_pct=$(grep -E '\d+%' output.txt)" >> "$GITEA_OUTPUT"
|
||||||
|
- id: update_svg
|
||||||
|
if: ${{ gitea.event_name == 'push' }}
|
||||||
|
run: |
|
||||||
|
ruby scripts/update-progress.rb
|
||||||
|
|
||||||
|
git config --global user.name 'Autobot'
|
||||||
|
git config --global user.email 'autobot@git.sangeeth.dev'
|
||||||
|
git add README.md
|
||||||
|
git commit -m 'chore: update progress in README.md'
|
||||||
|
git push
|
@ -1 +1 @@
|
|||||||
0,5,5,9,9,14,15,15,15,15,15,15,16,16,16,16,17,18,19,20,21,22,23,25,26,28,29,29,30,31,31,32,33,34,35,36,37,38,39,40,40,40,41,42,43,44,45,46,47,48,49,49,50,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,54,54,55,55,55,56,57,58,60,62,64,65,65,65,66,66,67,67,68,70,71,72,73,73,74,75,76,78
|
0,5,5,9,9,14,15,15,15,15,15,15,16,16,16,16,17,18,19,20,21,22,23,25,26,28,29,29,30,31,31,32,33,34,35,36,37,38,39,40,40,40,41,42,43,44,45,46,47,48,49,49,50,51,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,53,53,54,54,55,55,55,56,57,58,60,62,64,65,65,65,66,66,67,67,68,70,71,72,73,73,74,75,76,78,78,78,78
|
7
README.md
Normal file
7
README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# ruby-koans
|
||||||
|
|
||||||
|
<!-- AUTOGEN:pct -->
|
||||||
|
![](https://img.shields.io/badge/Progress-33%25-orange)
|
||||||
|
<!-- END:pct -->
|
||||||
|
|
||||||
|
Recording my path to enlightenment.
|
10
scripts/update-progress.rb
Normal file
10
scripts/update-progress.rb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
pattern = /(<!--\s*AUTOGEN:pct\s*-->\n)(.*)(\n<!--\s*END:pct\s*-->)/m
|
||||||
|
|
||||||
|
readme_contents = File.read('README.md')
|
||||||
|
new_pct = ARGV[0]
|
||||||
|
badge = "![](https://img.shields.io/badge/Progress-#{new_pct}%25-orange)"
|
||||||
|
new_readme_contents = readme_contents.gsub(pattern, %{\\1#{badge}\\3})
|
||||||
|
puts new_readme_contents
|
||||||
|
File.write('README.md', new_readme_contents)
|
Loading…
Reference in New Issue
Block a user