-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (58 loc) · 1.87 KB
/
convert_yaml_to_markdown.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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