Merge branch 'pest-mvp' of /~https://github.com/DominicBurkart/marigold… #120
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
name: badges | |
on: [push] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
badges: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: "Make lines of code and number of contributors badges" | |
run: | | |
format_number () { | |
if (( $# == 0 )) ; then | |
if ! command -v numfmt &> /dev/null | |
then | |
gnumfmt --to=si < /dev/stdin | |
else | |
numfmt --to=si < /dev/stdin | |
fi | |
else | |
if ! command -v numfmt &> /dev/null | |
then | |
gnumfmt --to=si "$1" | |
else | |
numfmt --to=si "$1" | |
fi | |
fi | |
} | |
rm -rf development_metadata/badges | |
mkdir development_metadata/badges | |
lines="$(git ls-files | grep -e '\.rs' -e '\.lalrpop' | xargs wc -l | tail -n 1 | awk '{$1=$1};1' | cut -d " " -f1 | format_number)" | |
curl "https://img.shields.io/badge/lines%20of%20code-$lines-informational" >> development_metadata/badges/lines_of_code.svg | |
curl "https://img.shields.io/badge/lines%20of%20code-$lines-informational?style=for-the-badge" >> development_metadata/badges/lines_of_code_ftb.svg | |
contributors="$(git shortlog -sne --all | rev | awk '{$1=$1};1' | cut -d " " -f1 | uniq | wc -l | awk '{$1=$1};1' | format_number)" | |
curl "https://img.shields.io/badge/contributors-$contributors-informational" >> development_metadata/badges/contributors.svg | |
curl "https://img.shields.io/badge/contributors-$contributors-informational?style=for-the-badge" >> development_metadata/badges/contributors_ftb.svg | |
git config user.name dominicburkart | |
git config user.email code@dominic.computer | |
git add development_metadata/badges/* | |
git commit -m "update badges" || true | |
git push || true |