Skip to content

Commit

Permalink
feat: add todo-counter badge creation (#73)
Browse files Browse the repository at this point in the history
* 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
yv-svstl and actions-user authored Mar 4, 2025
1 parent 9579cd6 commit 0f5123f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/assets/todo-count-badge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- master

env:
TODO_COUNT_BADGE_PATH: .github/assets/todo-count-badge.svg

jobs:
independent:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<img src="./.github/assets/todo-count-badge.svg">

# Wunderkafka

>The power of librdkafka for <s>humans</s> pythons
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "wunderkafka"
version = "0.19.0-beta.6"
version = "0.19.0-beta.11"
description = "librdkafka-powered client for Kafka for python with (hopefully) more handful API"
readme = "README.md"
keywords = ["kafka", "cloudera", "confluent"]
Expand Down

0 comments on commit 0f5123f

Please sign in to comment.