-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add todo-counter badge creation (#73)
* feat: add todo-counter badge creation * feat: temporary disable some steps * feat: temporary disable some steps * fix: add id to counting step * fix: badge path * fix: checkout branch * fix: checkout branch * fix: checkout at the current branch * fix: propper push * chore: update todo-counter badge * fix: status output * fix: cleanup * chore: update todo-counter badge * fix: todo-count output for the step * chore: update todo-counter badge * fix: correct badge color * chore: update todo-counter badge * fix: revert skipped steps * feat: add badge to readme * fix: revert pyproject.toml * chore: update todo-counter badge --------- Co-authored-by: GitHub Action <[email protected]>
- Loading branch information
1 parent
9579cd6
commit 0f5123f
Showing
4 changed files
with
78 additions
and
1 deletion.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ on: | |
branches: | ||
- master | ||
|
||
env: | ||
TODO_COUNT_BADGE_PATH: .github/assets/todo-count-badge.svg | ||
|
||
jobs: | ||
independent: | ||
runs-on: ubuntu-latest | ||
|
@@ -113,7 +116,53 @@ jobs: | |
uses: python-semantic-release/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
todo_counter: | ||
runs-on: ubuntu-latest | ||
name: Generate todo-counter Badge | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: Count Todo | ||
id: count_todo | ||
run: echo "todo-num=$(grep -riw "todo" wunderkafka tests | wc -l | xargs)" >> $GITHUB_OUTPUT | ||
- name: Generate the badge SVG image | ||
uses: emibcn/badge-action@v1 | ||
with: | ||
label: 'TODOs' | ||
status: ${{ steps.count_todo.outputs.todo-num }} | ||
path: ${{ env.TODO_COUNT_BADGE_PATH }} | ||
color: ${{ | ||
steps.count_todo.outputs.todo-num < 5 && 'green' || | ||
steps.count_todo.outputs.todo-num < 10 && 'yellow,green' || | ||
steps.count_todo.outputs.todo-num < 15 && 'yellow' || | ||
steps.count_todo.outputs.todo-num < 20 && 'orange,yellow' || | ||
steps.count_todo.outputs.todo-num < 25 && 'orange' || | ||
steps.count_todo.outputs.todo-num < 40 && 'red,orange' || | ||
steps.count_todo.outputs.todo-num < 50 && 'red,red,orange' || | ||
steps.count_todo.outputs.todo-num < 60 && 'red,red,red,orange' || | ||
'red' }} | ||
- name: Verify Changed files | ||
uses: tj-actions/verify-changed-files@v16 | ||
id: verify-changed-files | ||
with: | ||
files: ${{ env.TODO_COUNT_BADGE_PATH }} | ||
- name: Commit badge | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
git pull | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add $TODO_COUNT_BADGE_PATH | ||
git commit -m "chore: update todo-counter badge" | ||
- name: Push badge commit | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
branch: ${{ github.head_ref }} | ||
deploy: | ||
needs: [checks, version] | ||
runs-on: ubuntu-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters