Skip to content

Commit

Permalink
Merge pull request #82 from alchem0x2A/master
Browse files Browse the repository at this point in the history
use pr body text to mark PR region
  • Loading branch information
alchem0x2A authored Nov 28, 2024
2 parents 034e84e + efbde8e commit 87f82f3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 17 deletions.
28 changes: 17 additions & 11 deletions .github/workflows/update_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,22 @@ jobs:
echo UPDATE_NEEDED is "${UPDATE_NEEDED}"
echo API version is "${API_VERSION}"
continue-on-error: true
- name: Create Pull Request
- name: Create PR body text
if: env.UPDATE_NEEDED == 'true'
run: |
touch pr_body.txt
echo "## Automated JSON API Update" >> pr_body.txt
echo "Hello! This is an automatic pull request to merge the new JSON API version **${API_VERSION}** into the master branch." >> pr_body.txt
echo "### Details" >> pr_body.txt
echo "- **Workflow Trigger**: This update is triggered by the **Update JSON API (recurring job)** workflow." >> pr_body.txt
echo "- **Reason for Update**: A new JSON schema version was generated that differs from the existing one in the repository." >> pr_body.txt
echo "### Notes" >> pr_body.txt
echo "- If you notice any issues or have questions regarding this update, please contact @alchem0x2a or other maintainers of the repository." >> pr_body.txt
echo "Thank you for keeping the SPARC-X-API project up-to-date! 🚀" >> pr_body.txt
cat pr_body.txt
- name: Create Pull Request
# Do not create PR from another PR
if: (env.UPDATE_NEEDED == 'true') && (github.event_name != 'pull_request')
run: |
git config --global user.email "[email protected]"
git config --global user.name "Github Action Bot"
Expand All @@ -61,18 +75,10 @@ jobs:
git add sparc/sparc_json_api/parameters.json
git commit -m "Add new json api version ${API_VERSION}"
git push --force --set-upstream origin ${BRANCH_NAME}
body_msg=""
body_msg="${body_msg}## Automated JSON API Update\n"
body_msg="${body_msg}Hello! This is an automatic pull request to merge the new JSON API version **${API_VERSION}** into the master branch.\n\n"
body_msg="${body_msg}### Details:\n"
body_msg="${body_msg}- **Workflow Trigger**: This update is triggered by the **Update JSON API (recurring job)** workflow.\n"
body_msg="${body_msg}- **Reason for Update**: A new JSON schema version was generated that differs from the existing one in the repository.\n\n"
body_msg="${body_msg}### Notes:\n"
body_msg="${body_msg}- If you notice any issues or have questions regarding this update, please contact @alchem0x2a or other maintainers of the repository.\n\n"
body_msg="${body_msg}Thank you for keeping the SPARC-X-API project up-to-date! 🚀\n"
gh pr create --base master \
--title "[PR Bot] New JSON API version ${API_VERSION}" \
--body "${body_msg}" \
--body-file pr_body.txt \
-R ${{ github.repository_owner }}/SPARC-X-API
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Binary file added doc/img/screenshots/api_update_pr_github.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 12 additions & 5 deletions doc/maintainers/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ setting](https://github.com/SPARC-X/SPARC-X-API/settings/pages) and
set the "Source" to "Deploy from a branch", as well as "Branch" to
"gh_pages", as shown in the UI screenshot below:

![Github Pages Settings](img/screenshots/github_pages_setting.png)
![Github Pages Settings](../img/screenshots/github_pages_setting.png)


### Secrets
Expand Down Expand Up @@ -54,7 +54,7 @@ files) for debug purposes, from the "Run workflow" drop panel in the
page](https://github.com/SPARC-X/SPARC-X-API/actions/workflows), as
shown in the screenshot below:

![Github Actions Manual Dispatch](img/screenshots/github_action_dispatch.png)
![Github Actions Manual Dispatch](../img/screenshots/github_action_dispatch.png)

- [Unit-test
workflow](https://github.com/SPARC-X/SPARC-X-API/blob/master/.github/workflows/unit_test.yml)
Expand All @@ -79,10 +79,17 @@ shown in the screenshot below:
- [Update JSON schema
workflow](https://github.com/SPARC-X/SPARC-X-API/blob/master/.github/workflows/update_api.yml)
updates the JSON schema file after a new release in SPARC C/C++
source code.
source code. The workflow is run both nightly and after normal
push. You can change the behavior as needed.

The workflow is run both nightly and after normal push. Change the
behavior as needed.
An example pull request created by the update workflow can be seen
in the following screenshot:

```{figure} ../img/screenshots/api_update_pr_github.png
:alt: PR on github
```

Once the

- [Publish PyPI
workflow](https://github.com/SPARC-X/SPARC-X-API/blob/master/.github/workflows/publish-pypi.yml)
Expand Down
2 changes: 1 addition & 1 deletion doc/maintainers/sparc-x-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ workflow. Instead, it uses the [OIDC
protocol](https://docs.pypi.org/trusted-publishers/) for a trusted
publisher. The current settings on PyPI are like follows:

![pypi-setting](img/screenshots/pypi_publisher_setup.png)
![pypi-setting](../img/screenshots/pypi_publisher_setup.png)

0 comments on commit 87f82f3

Please sign in to comment.