testing 17 #17
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: Convert YAML to Markdown | |
on: | |
push: | |
paths: | |
- '**.yaml' | |
permissions: | |
contents: write # Grant write permissions | |
pull-requests: write # Grant permissions to create pull requests | |
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 | |
if [[ $file == *.yaml ]]; then | |
echo "Processing $file..." | |
python scripts/yaml_to_markdown.py $file | |
else | |
echo "Skipping non-YAML file: $file" | |
fi | |
done | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: 'Convert YAML to Markdown' | |
branch: 'yaml-to-markdown-conversion' | |
title: 'Convert YAML to Markdown' | |
body: 'This pull request converts updated YAML files to Markdown format.' | |
committer: GitHub <[email protected]> | |
author: asucrews <[email protected]> | |
signoff: false | |
delete-branch: false | |
draft: false |