update descriptions #12
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: Generate Services Markdown | |
on: | |
push: | |
paths: | |
- 'services-available/*.yml' | |
- '.github/workflows/update-services.yml' | |
jobs: | |
generate-services-markdown: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# - name: Check for Changes | |
# id: changes | |
# run: | | |
# if git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | grep -q 'services-available/.*\.yml\|\.github/update-services\.yml'; then | |
# echo "changed=true" >> $GITHUB_OUTPUT | |
# else | |
# echo "changed=false" >> $GITHUB_OUTPUT | |
# fi | |
- name: Generate Services Markdown | |
#if: steps.changes.outputs.changed == 'true' | |
run: | | |
services="" | |
for file in ./services-available/*.yml; do | |
service_name=$(basename "$file" .yml) | |
service_link=$(sed -n '/^#\s+https/p' "$file" | sed 's/^#\s*//g' | head -n 1) | |
description=$(sed -n 's/^#\s+description: //p' "$file" | head -n 1) | |
if [ -n "$service_link" ]; then | |
services="$services\n- [$service_name]($service_link): $description" | |
else | |
services="$services\n- $service_name: $description" | |
fi | |
done | |
echo "# Available Services" > ./SERVICES.md | |
echo "" >> ./SERVICES.md | |
echo -e "$services" >> ./SERVICES.md | |
- name: Commit Services Markdown | |
#if: steps.changes.outputs.changed == 'true' | |
run: | | |
git config --global user.name 'GitHub Actions' | |
git config --global user.email '[email protected]' | |
git add ./SERVICES.md | |
git commit -m "Update services.md" || echo "No changes to commit" | |
git push |