forked from opensearch-project/opensearch-py
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: saimedhi <[email protected]>
- Loading branch information
Showing
3 changed files
with
72 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Update OpenSearch API | ||
on: [push] | ||
jobs: | ||
update-api: | ||
if: ${{ github.repository == 'saimedhi/opensearch-py' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
fetch-depth: 0 | ||
- name: Config git to rebase | ||
run: git config --global pull.rebase true | ||
- name: Set up Python 3.7 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.7 | ||
- name: Install dependencies | ||
run: | | ||
python3.7 -m pip install nox | ||
- name: Generate API | ||
run: nox -s generate | ||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
- name: GitHub App token | ||
if: ${{ github.repository == 'saimedhi/opensearch-py' }} | ||
id: github_app_token | ||
uses: tibdex/[email protected] | ||
with: | ||
app_id: ${{ secrets.CI_APP_ID }} | ||
private_key: ${{ secrets.CI_APP_PRIVATE_KEY }} | ||
- name: Create pull request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: Updated opensearch-py to reflect the latest OpenSearch API spec (${{ steps.date.outputs.date }}) | ||
title: Updated opensearch-py to reflect the latest OpenSearch API spec | ||
body: | | ||
Updated [opensearch-py](https://github.com/saimedhi/opensearch-py) to reflect the latest [OpenSearch API spec](https://github.com/opensearch-project/opensearch-api-specification/blob/main/OpenSearch.openapi.json) | ||
Date: ${{ steps.date.outputs.date }} | ||
branch: automated-api-update | ||
base: main | ||
committer: opensearchpy-api-update-bot <[email protected]> | ||
author: opensearchpy-api-update-bot <[email protected]> | ||
- name: Update CHANGELOG | ||
uses: jacobtomlinson/gha-find-replace@v3 | ||
if: ${{ steps.cpr.outputs.pull-request-number != '' }} | ||
with: | ||
include: CHANGELOG.md | ||
find: "\\- Your contribution here." | ||
replace: "- Updated opensearch-py to reflect the latest OpenSearch API spec ([#${{steps.cpr.outputs.pull-request-number}}](https://github.com/opensearch-project/opensearch-py/pull/${{steps.cpr.outputs.pull-request-number}}))\n- Your contribution here." | ||
- name: Commit and Push | ||
if: ${{ steps.cpr.outputs.pull-request-number != '' }} | ||
run: | | ||
git config --local user.name 'opensearchpy-api-update-bot' | ||
git config --local user.email '[email protected]' | ||
git config --local --unset-all http.https://github.com/.extraheader || true | ||
AUTH=$(echo -n "x-access-token:${{ steps.github_app_token.outputs.token || secrets.GITHUB_TOKEN }}" | base64) | ||
echo "::add-mask::${AUTH}" | ||
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${AUTH}" | ||
git add CHANGELOG.md | ||
git commit --amend --no-edit | ||
git push origin automated-api-update -f | ||
This file contains 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
This file contains 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