Skip to content

Commit ec0fdfe

Browse files
committed
Update README from JSON (source)
These changes will update the README from JSON file using GitHub actions. The JSON file becomes the source of data for the README. The README will be updated automatically when the JSON file is updated. The JSON file will be used to generate the README file using a python script. The python script will be run using GitHub actions.
1 parent abe48d4 commit ec0fdfe

8 files changed

+1468
-51
lines changed

.github/workflows/update_readme.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Update README from JSON
2+
# This workflow automatically updates the README file whenever the JSON file or the script changes.
3+
on:
4+
push:
5+
paths:
6+
- "awesome_open_geoscience.json" # JSON file in root directory
7+
- "scripts/json_to_readme.py" # Python script
8+
- "scripts/order.txt" # Order file
9+
- "media/**" # Anything in 'media' folder
10+
workflow_dispatch: # Allows manual triggering in GitHub Actions UI
11+
inputs:
12+
update_readme:
13+
type: boolean
14+
required: false
15+
default: false
16+
# schedule:
17+
# - cron: "0 0 * * 0" # Weekly on Sundays at midnight UTC
18+
19+
workflow_run:
20+
# This workflow will run after the "Validate JSON Entries" workflow is completed
21+
workflows: ["Validate JSON Entries"]
22+
types: [completed]
23+
branches:
24+
- main
25+
26+
jobs:
27+
update-readme:
28+
# run only if the previous workflow run was successful or if manually triggered
29+
# This is to prevent the README update from running if the JSON validation fails
30+
if: >
31+
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
32+
(github.event_name == 'workflow_dispatch' && github.event.inputs.update_readme == 'true')
33+
34+
runs-on: ubuntu-latest
35+
# Grant write permissions to the GITHUB_TOKEN
36+
permissions:
37+
contents: write
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: "3.10"
48+
49+
- name: Install dependencies
50+
run: pip install pyyaml
51+
52+
- name: Generate README
53+
run: python scripts/json_to_readme.py awesome_open_geoscience.json scripts/order.txt
54+
55+
- name: Check for changes
56+
id: git-check
57+
run: |
58+
git diff --quiet README.md || echo "changes=true" >> $GITHUB_OUTPUT
59+
60+
- name: Commit and push changes
61+
if: steps.git-check.outputs.changes == 'true'
62+
run: |
63+
git config --global user.name "github-actions[bot]"
64+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
65+
git add README.md
66+
git commit -m "Auto-update README from JSON [skip ci]" || echo "No changes to commit"
67+
# Use GITHUB_TOKEN for authentication
68+
git push "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" HEAD:main

.github/workflows/validate_json.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Validate JSON Entries
2+
description: Validate JSON entries in awesome_open_geoscience.json
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "awesome_open_geoscience.json"
10+
pull_request:
11+
paths:
12+
- "awesome_open_geoscience.json"
13+
workflow_dispatch:
14+
15+
jobs:
16+
check-entries:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install dependencies
28+
run: pip install jsonschema
29+
30+
- name: Validate JSON Entries
31+
run: |
32+
python scripts/validate_json_entries.py awesome_open_geoscience.json

.lycheeignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Fsoftwareunderground%2Fawesome-open-geoscience
22
https://geoscience.data.qld.gov.au
33
https://opensource.org/license/lgpl-license-html
4-
https://opensource.org/licenses/gpl-license
4+
https://opensource.org/licenses/gpl-license
55
https://reproducibility.org/wiki/Installation
66
https://wiki.seg.org/wiki/Open_data
77
https://www.gnu.org/licenses/license-list.html#NonFreeDocumentationLicenses
@@ -16,3 +16,4 @@ http://www.fsf.org/licensing/licenses/
1616
https://www.fsf.org/licensing/licenses/
1717
https://www.gnu.org/licenses/
1818
http://www.gnu.org/licenses/
19+
https://researchportal.hw.ac.uk/en/datasets/costa-model-hierarchical-carbonate-reservoir-benchmarking-case-st

README.md

Lines changed: 89 additions & 50 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)