Add xml to yaml converter, update Markdown and Yaml files automatical… #1
This file contains hidden or 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: Render xml standard name dictionary to markdown and yaml and commit to repository | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-md-and-yaml: | |
name: Render xml to markdown and yaml and commit | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Configure git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libxml2-utils | |
python -m pip install --upgrade pip | |
python -m pip install PyYaml | |
- name: Render xml to markdown | |
run: | | |
tools/write_standard_name_table.py --output-format md standard_names.xml | |
echo "The following changes will be committed (git diff Metadata-standard-names.md):" | |
git diff Metadata-standard-names.md | |
git add Metadata-standard-names.md | |
- name: Rendering xml to yaml | |
run: | | |
tools/write_standard_name_table.py --output-format yaml standard_names.xml | |
echo "The following changes will be committed (git diff Metadata-standard-names.yaml):" | |
git diff Metadata-standard-names.yaml | |
git add Metadata-standard-names.yaml | |
- name: Commit and push changes | |
run: | | |
git commit -m "Update Metadata-standard-names.{md,yaml} from standard_names.xml" || echo "No changes to commit" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |