Check Open API Framework Version #40
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
name: open-api-workflow oaf-check | |
on: | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
oaf-up-to-date: | |
name: Check for new OAF version | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: 'pip' | |
cache-dependency-path: 'requirements/dev.txt' | |
- name: Install dependencies | |
run: pip install $(grep "pip-tools==" requirements/dev.txt) | |
- name: Run compile dependencies | |
run: ./bin/compile_dependencies.sh --upgrade-package open-api-framework | |
- name: Check git diff | |
run: git diff --exit-code -- requirements/*.txt | |
create-oaf-update-pr: | |
name: Create a pull requests to update OAF | |
runs-on: ubuntu-latest | |
needs: [oaf-up-to-date] | |
if: failure() | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
cache: 'pip' | |
cache-dependency-path: 'requirements/dev.txt' | |
- name: Install dependencies | |
run: pip install $(grep "pip-tools==" requirements/dev.txt) | |
- name: Run compile dependencies | |
run: ./bin/compile_dependencies.sh --upgrade-package open-api-framework | |
- name: Get OAF Version | |
run: echo "OAF_VERSION=$(grep -Po '(?<=open-api-framework==)[^\n]*' requirements/dev.txt)" >> $GITHUB_ENV | |
# Git | |
- name: Create and Checkout Branch | |
run: git checkout -q -B update/open-api-framework-${{env.OAF_VERSION}} | |
- name: Commit Changes | |
run: "git commit -i requirements/*.txt -m ':arrow_up: Update Open-API-Framework to ${{env.OAF_VERSION}}'" | |
- name: Push Changes | |
run: git push -f --set-upstream origin update/open-api-framework-${{env.OAF_VERSION}} | |
# GitHub | |
- name: Check for Existing PR | |
id: existing-pr | |
continue-on-error: true | |
run: gh pr view update/open-api-framework-${{env.OAF_VERSION}} >> /dev/null | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Create New PR | |
if: failure() | |
run: | | |
gh pr create --title "Update Open API Framework to ${{env.OAF_VERSION}}"\ | |
--body "[Auto generated with github action.]($ACTION_URL)" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
ACTION_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" |