diff --git a/.gitea/workflows/validate-on-push.yml b/.gitea/workflows/validate-on-push.yml new file mode 100644 index 0000000..dccc4af --- /dev/null +++ b/.gitea/workflows/validate-on-push.yml @@ -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 diff --git a/.path_progress b/.path_progress index 8041235..d4ba9c9 100644 --- a/.path_progress +++ b/.path_progress @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..ba6049a --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# ruby-koans + + +![](https://img.shields.io/badge/Progress-33%25-orange) + + +Recording my path to enlightenment. diff --git a/scripts/update-progress.rb b/scripts/update-progress.rb new file mode 100644 index 0000000..59d4422 --- /dev/null +++ b/scripts/update-progress.rb @@ -0,0 +1,10 @@ +#!/usr/bin/env ruby + +pattern = /(\n)(.*)(\n)/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)