Skip to content

Commit 1e7b451

Browse files
author
Test User
committed
Add .github/workflows/commit_to_main.yml
1 parent e743db1 commit 1e7b451

File tree

2 files changed

+75
-9
lines changed

2 files changed

+75
-9
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Render xml standard name dictionary to markdown and yaml and commit to repository
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
commit-file:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: "3.x"
23+
24+
- name: Configure git
25+
run: |
26+
git config --global user.name "github-actions[bot]"
27+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
28+
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get -y install libxml2-utils
33+
python -m pip install --upgrade pip
34+
python -m pip install PyYaml
35+
36+
- name: Render xml to markdown
37+
run: |
38+
tools/write_standard_name_table.py --output-format md standard_names.xml
39+
echo "The following changes will be committed (git diff Metadata-standard-names.md):"
40+
git diff Metadata-standard-names.md
41+
git add Metadata-standard-names.md
42+
git commit -m "Update Metadata-standard-names.md from standard_names.xml" || echo "No changes to commit"
43+
44+
- name: Rendering xml to yaml
45+
run: |
46+
tools/write_standard_name_table.py --output-format yaml standard_names.xml
47+
echo "The following changes will be committed (git diff Metadata-standard-names.yaml):"
48+
git diff Metadata-standard-names.yaml
49+
git add Metadata-standard-names.yaml
50+
git commit -m "Update Metadata-standard-names.yaml from standard_names.xml" || echo "No changes to commit"
51+
52+
- name: Push changes
53+
run: |
54+
git push
55+
env:
56+
# This uses the default GITHUB_TOKEN with write permissions
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pull_request_ci.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@ name: Pull request checks
22

33
on:
44
pull_request:
5-
branches: [main]
5+
branches:
6+
- main
67

78
jobs:
89
check-unique-standard-names:
10+
name: Check for duplicates in standard names
911
runs-on: ubuntu-latest
1012
steps:
11-
- uses: actions/checkout@v4
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
1215

13-
- uses: actions/setup-python@v4
16+
- name: Setup Python
17+
uses: actions/setup-python@v4
1418
with:
1519
python-version: "3.x"
1620

@@ -20,7 +24,8 @@ jobs:
2024
sudo apt-get -y install libxml2-utils
2125
2226
- name: Check for duplicate standard names
23-
run: tools/check_xml_unique.py standard_names.xml
27+
run: |
28+
tools/check_xml_unique.py standard_names.xml
2429
2530
check-name-rules:
2631
name: Check standard names against rules
@@ -30,7 +35,8 @@ jobs:
3035
- name: Checkout repository
3136
uses: actions/checkout@v4
3237

33-
- uses: actions/setup-python@v4
38+
- name: Setup Python
39+
uses: actions/setup-python@v4
3440
with:
3541
python-version: "3.x"
3642

@@ -44,11 +50,14 @@ jobs:
4450
python3 tools/check_name_rules.py -s standard_names.xml
4551
4652
test-rendering:
53+
name: Test rendering xml file to markdown and yaml
4754
runs-on: ubuntu-latest
4855
steps:
49-
- uses: actions/checkout@v4
56+
- name: Checkout repository
57+
uses: actions/checkout@v4
5058

51-
- uses: actions/setup-python@v4
59+
- name: Setup Python
60+
uses: actions/setup-python@v4
5261
with:
5362
python-version: "3.x"
5463

@@ -59,13 +68,13 @@ jobs:
5968
python -m pip install --upgrade pip
6069
python -m pip install PyYaml
6170
62-
- name: Test rendering xml file into markdown
71+
- name: Test rendering xml file to markdown
6372
run: |
6473
tools/write_standard_name_table.py --output-format md standard_names.xml
6574
echo "The following changes will be committed when this pull request is merged (git diff Metadata-standard-names.md):"
6675
git diff Metadata-standard-names.md
6776
68-
- name: Test rendering xml file into yaml
77+
- name: Test rendering xml file to yaml
6978
run: |
7079
tools/write_standard_name_table.py --output-format yaml standard_names.xml
7180
echo "The following changes will be committed when this pull request is merged (git diff Metadata-standard-names.yaml):"

0 commit comments

Comments
 (0)