Skip to content

testing 6

testing 6 #6

name: Convert YAML to Markdown
on:
push:
paths:
- '**.yaml'
jobs:
convert:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install PyYAML
run: pip install pyyaml
- name: Find changed YAML files
id: find_files
run: |
echo "##[group]Detecting changed YAML files"
if git rev-parse HEAD^ >/dev/null 2>&1; then
files=$(git diff --name-only HEAD^ HEAD | grep '.yaml' || true)
else
files=$(git ls-files '*.yaml' || true)
fi
echo "found files: $files"
echo "##[endgroup]"
echo "files=$(echo $files | tr '\n' ' ')" >> $GITHUB_ENV
- name: Convert YAML to Markdown
if: env.files != ''
run: |
for file in ${{ env.files }}; do
echo "Processing $file..."
python scripts/yaml_to_markdown.py $file
done
- name: Commit and push changes
if: env.files != ''
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add .
git commit -m 'Convert YAML to Markdown'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}