Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ci.yml #228

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 43 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@ jobs:
uses: mhiew/redoc-lint-github-action@v4
with:
args: 'openapi/task_execution_service.openapi.yaml'
validate:
name: Validate OpenAPI definition
runs-on: ubuntu-latest
steps:
- name: Check out head branch
uses: actions/checkout@v4
- name: Run OpenAPI Validate Action
uses: char0n/swagger-editor-validate@v1
with:
definition-file: openapi/task_execution_service.openapi.yaml
diff:
name: Show OpenAPI differences relative to target branch
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
outputs:
diff_generated: ${{ steps.upload-log.outputs.artifact_id }}
steps:
- name: Check out head branch
uses: actions/checkout@v4
Expand All @@ -27,19 +38,36 @@ jobs:
with:
ref: ${{ github.event.pull_request.base.ref }}
path: base
- name: Run OpenAPI Diff Action
uses: mvegter/[email protected]
- name: Run OpenAPI Diff
run: |
docker run --rm \
-v $(pwd)/head:/head:ro \
-v $(pwd)/base:/base:ro \
-v $(pwd):/local \
openapitools/openapi-diff:2.0.1 \
/head/openapi/task_execution_service.openapi.yaml \
/base/openapi/task_execution_service.openapi.yaml \
--markdown /local/diff.md
- name: Upload log
id: upload-log
uses: actions/upload-artifact@v4
with:
head-spec: head/openapi/task_execution_service.openapi.yaml
base-spec: base/openapi/task_execution_service.openapi.yaml

validate:
name: Validate OpenAPI definition
runs-on: ubuntu-latest
steps:
- name: Check out head branch
uses: actions/checkout@v4
- name: Run OpenAPI Validate Action
uses: char0n/swagger-editor-validate@v1
name: openapi-diff-log
path: diff.md
- name: Get PR number
id: get_pr_number
run: |
if [[ -n "${{ github.event.pull_request.number }}" ]]; then
echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "pr_number=$(jq '.pull_request.number' $GITHUB_EVENT_PATH)" >> $GITHUB_OUTPUT
fi
- name: Save PR number to file
run: |
echo "${{ steps.get_pr_number.outputs.pr_number }}"
echo "${{ steps.get_pr_number.outputs.pr_number }}" > pr_number.txt
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
definition-file: openapi/task_execution_service.openapi.yaml
name: pr-number
path: pr_number.txt
Loading