Files
hassio-addons/.github/workflows/daily_READMEgen.yaml
2022-04-20 14:59:48 +02:00

45 lines
1.9 KiB
YAML

# yamllint disable rule:line-length
---
name: Generate README
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
crlf_to_lf:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Run script file
run: |
rm README.md
cp .README.j2 README.md
ADDONSLINE=$(sed -n '/%%ADDONS_LIST%%/=' README.md)
echo "line is $ADDONSLINE"
sed -i "$ADDONSLINEd" README.md
for f in *; do
# $f is an addon directory
if [ -f "$f"/config.json ]; then
echo "Project $f"
[[ $(jq '.arch[]' "$f/config.json") == *"aarch64"* ]] && echo "aarch64" && sed -i "$ADDONSLINE"'i ![aarch64][aarch64-badge]' README.md || true
[[ $(jq '.arch[]' "$f/config.json") == *"amd64"* ]] && echo "amd64" && sed -i "$ADDONSLINE"'i ![amd64][amd64-badge]' README.md || true
[[ $(jq '.arch[]' "$f/config.json") == *"armv7"* ]] && echo "armv7" && sed -i "$ADDONSLINE"'i ![armv7][armv7-badge]' README.md || true
[ $(jq '.ingress' "$f/config.json") ] && echo "ingress" && sed -i "$ADDONSLINE"'i ![ingress][ingress-badge]' README.md || true
[ $(jq '.codenotary' "$f/config.json") ] && echo "codenotary" && sed -i "$ADDONSLINE"'i ![Signed][signed-badge]' README.md || true
[ $(jq '.version' "$f/config.json") ] && echo "version" && sed -i "$ADDONSLINE"'i ![version][version-badge]' README.md || true
NAME=$(jq '.name' $f/config.json)
DESCRIPTION=$(jq '.description' $f/config.json)
sed -i "$ADDONSLINE"'i ['$NAME']('$f'/) : '"$DESCRIPTION" README.md
fi
done
shell: bash
- name: Create New Pull Request If Needed
uses: peter-evans/create-pull-request@v3
with:
title: "Github bot : README updated"
branch-suffix: timestamp
commit-message: "Github bot : README updated"