diff --git a/.github/.wiki/CMIP6plus.png b/.github/.wiki/CMIP6plus.png new file mode 100644 index 00000000..89ca1220 Binary files /dev/null and b/.github/.wiki/CMIP6plus.png differ diff --git a/.github/.wiki/CMIP6plus.svg b/.github/.wiki/CMIP6plus.svg new file mode 100644 index 00000000..24624407 --- /dev/null +++ b/.github/.wiki/CMIP6plus.svg @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + CMIP6 PLUS + + diff --git a/.github/.wiki/README.md b/.github/.wiki/README.md new file mode 100644 index 00000000..d0600dba --- /dev/null +++ b/.github/.wiki/README.md @@ -0,0 +1 @@ +A store of materials needed for the wiki diff --git a/.github/.wiki/cmip6plus600.png b/.github/.wiki/cmip6plus600.png new file mode 100644 index 00000000..b016fb71 Binary files /dev/null and b/.github/.wiki/cmip6plus600.png differ diff --git a/.github/.wiki/model_components.png b/.github/.wiki/model_components.png new file mode 100644 index 00000000..cb30796f Binary files /dev/null and b/.github/.wiki/model_components.png differ diff --git a/.github/.wiki/source_id.png b/.github/.wiki/source_id.png new file mode 100644 index 00000000..2d9f7189 Binary files /dev/null and b/.github/.wiki/source_id.png differ diff --git a/.github/libs/source_id.py b/.github/libs/source_id.py index 2f0aee26..9ba3b3c3 100644 --- a/.github/libs/source_id.py +++ b/.github/libs/source_id.py @@ -44,8 +44,10 @@ # sort out the model components for c in component_list: + if c not in data: continue cdummy = data[c][0] model_components[c] = OrderedDict({"description": cdummy.get('description','none'), + "version":cdummy.get('version number','none'), "native_nominal_resolution": cdummy.get('resolution','none') }) license = data['license(automated)'][0] @@ -66,7 +68,7 @@ "license": license['license_id'], "url": license['license_url'], "exceptions_contact": "@%s <- %s"%tuple(data['license_exceptions_contact'].split('@')[::-1]), - "history": data.get('license_history',''), + # "history": data.get('license_history',''), "source_specific_info": data.get("source_specific_info",''), }), diff --git a/.github/workflows/source_id.yml b/.github/workflows/source_id.yml index 758675b3..157c8fe9 100644 --- a/.github/workflows/source_id.yml +++ b/.github/workflows/source_id.yml @@ -62,12 +62,29 @@ jobs: GITHUB_USERNAME: ${{ github.event.client_payload.author }} run: | + + repository="${{ github.repository }}" + github_token="${{ secrets.GITHUB_TOKEN }}" + + base_branch="main" feature_branch="source_id_${{ github.event.client_payload.name }}" git pull - git checkout -b $feature_branch; - + + remote_branch="origin/$feature_branch" + branch_info=$(git rev-parse --verify "$remote_branch" 2>&1) + echo "branch info: $branch_info" + + if [ -n "$branch_info" ]; then + + git checkout $feature_branch + git reset --hard origin/main + + else + git checkout -b $feature_branch; + fi + content=$(python .github/libs/source_id.py -k ${{ github.event.client_payload.key }} -r ${{ github.event.client_payload.record }}) git config --global user.email "${GITHUB_USERNAME}@users.noreply.github.com" @@ -76,18 +93,62 @@ jobs: git add *source_id.json git commit -m "Adding ${{ github.event.client_payload.name }} to source_id" - git push origin $feature_branch + git push origin $feature_branch --force - gh pr create --base $base_branch --head $feature_branch --title "New Source ID - add ${{ github.event.client_payload.name }}" --body \ - "This pull request was automatically created by a GitHub Actions workflow. - Data submitted by @${{github.event.client_payload.author}} - - Adding the following new data. - \`\`\`json - $content - \`\`\` - - " --reviewer $GITHUB_USERNAME + if [ -n "$branch_info" ]; then + pull_requests=$(curl -s -H "Authorization: token $github_token" \ + "https://api.github.com/repos/$repository/pulls?state=open&head=$feature_branch" | jq -r '.[].number') + + # base is main, head is our branch. + + echo "pull requests ${pull_requests}"; + # Iterate through each pull request and add the comment + for pr_number in $pull_requests; do + # author=$(curl -s -H "Authorization: token $github_token" \ + # "https://api.github.com/repos/$repository/pulls/$pr_number" | jq -r '.user.login') + + echo "running pull request $pr_number" ; +# keep indentation of comment_body !important + comment_body="This pull request (#$pr_number) was automatically updated by a GitHub Actions workflow. + + Data submitted by @${{github.event.client_payload.author}} + + Adding the following updated data. + \`\`\`json + $content + \`\`\` + " + # escaped=$(echo "$comment_body" | sed 's/"/\\"/g') + echo "comment- $comment_body" + + # # Add comment to the pull request + # curl -s -H "Authorization: token $github_token" \ + # -x POST -d '{"body": "$comment_body"}' \ + # "https://api.github.com/repos/$repository/issues/$pr_number/comments" + # # > /dev/null + + gh pr comment $pr_number --body "$comment_body" + + echo "Comment added to pull request #$pr_number" + done + + else + + + echo "clean pull" + gh pr create --base $base_branch --head $feature_branch --title "New Source ID - add ${{ github.event.client_payload.name }}" --body \ + "This pull request was automatically created by a GitHub Actions workflow. + + Data submitted by @${{github.event.client_payload.author}} + + Adding the following new data. + \`\`\`json + $content + \`\`\` + + " --reviewer $GITHUB_USERNAME + + fi diff --git a/2 b/2 new file mode 100644 index 00000000..9e55348f --- /dev/null +++ b/2 @@ -0,0 +1 @@ +8bd4ab6d051269250878053a78550cbd869dc398 diff --git a/CVs/CMIP6Plus_CV.json b/CVs/CMIP6Plus_CV.json index dca52087..7ab1c506 100644 --- a/CVs/CMIP6Plus_CV.json +++ b/CVs/CMIP6Plus_CV.json @@ -824,16 +824,16 @@ } }, "source_type": [ - "AOGCM", + "AGCM", + "ISM", "RAD", - "CHEM", + "AER", "BGC", - "OGCM", - "SLAB", + "AOGCM", + "CHEM", "LAND", - "ISM", - "AGCM", - "AER" + "SLAB", + "OGCM" ], "sub_experiment_id": { "f2023": "Forcings 2023", @@ -926,17 +926,17 @@ "r[[:digit:]]\\{1,\\}i[[:digit:]]\\{1,\\}p[[:digit:]]\\{1,\\}f[[:digit:]]\\{1,\\}$" ], "version_metadata": { - "file_updated": "Wed Nov 29 2023 20:07 UTC", - "checksum": "md5: b58d180fb606ec2f1bdbf3a7c2c16284", + "file_updated": "Fri Dec 01 2023 00:46 UTC", + "checksum": "md5: 9df16d5fbc8535b6face1808460afe71", "CVs": { - "updated": "2023-11-29T20:06:39Z", + "updated": "2023-12-01T00:45:53Z", "tag": "v6.5.0.0", - "commit": "b3bd7bde5b4aae11ff5558212134ac34f504da6c" + "commit": "0e7555baae3a5c24dbf80756b6720d89c38c2f4f" }, "MIP tables": { - "updated": "2023-11-28T22:38:28Z", + "updated": "2023-11-30T15:33:29Z", "tag": "v6.5.0.0", - "commit": "32a28db93193883d644560b3b36410c2e85c5eb5", + "commit": "49d4cfb8bca2f0bbed3608f278e7261f02e28c16", "url": "https://www.github.com/repos/PCMDI/mip-cmor-tables" }, "autogenerated": "True" diff --git a/README.md b/README.md index 653c1c77..63205fd0 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# CMIP6Plus_CVs +# CMIP6Plus Controlled Vocabularies Core Controlled Vocabularies (CVs) for use in CMIP6Plus #
+ +
@@ -41,6 +43,10 @@ Core Controlled Vocabularies (CVs) for use in CMIP6Plus # +## For information on how to interact +Visit the wiki using the button above, or [this link](https://github.com/WCRP-CMIP/CMIP6Plus_CVs/wiki) + +## Currently active MIPs To see a listing of currently active or planning activities/MIPs, please review details on the [Model Intercomparison Projects (MIPs)](https://wcrp-cmip.org/model-intercomparison-projects-mips/) page on the CMIP website.
Description