-
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.
Publish new version from API Evolution Management Service CI (https:/…
- Loading branch information
API Evolution Management Service CI
committed
May 10, 2023
0 parents
commit f7f4e28
Showing
3 changed files
with
111 additions
and
0 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,24 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Bump version and create a release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CREATE_RELEASE_TOKEN }} | ||
with: | ||
tag_name: v1.2.0-beta | ||
release_name: Release v1.2.0-beta | ||
draft: false | ||
prerelease: false |
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,35 @@ | ||
# API Evolution Check Action | ||
|
||
This GitHub Action checks for breaking changes in your API specifications by comparing the current branch's API specification file with the one in the main branch. It requires a file path to your OpenAPI specification file and an access token for the API Evolution Management Service. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Required | | ||
|---------------|------------------------------------------------------|----------| | ||
| `file_path` | Path to the API specification file you want to compare | Yes | | ||
| `access_token`| API Evolution Management Service access token | Yes | | ||
|
||
## Example | ||
|
||
This example demonstrates how to use the action in a workflow: | ||
|
||
```yaml | ||
name: API Evolution Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- '*' # This will match any branch | ||
|
||
jobs: | ||
api_evolution_check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Run API Evolution Check | ||
uses: fernandomrtnz/[email protected] | ||
with: | ||
file_path: openapi.yml | ||
access_token: ${{ secrets.APIEMS_ACCESS_TOKEN }} | ||
``` |
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,52 @@ | ||
name: gh-action-test-tostones | ||
description: "Check for breaking changes in API specifications" | ||
|
||
inputs: | ||
file_path: | ||
description: "Path to the API specification that you want to compare" | ||
required: true | ||
access_token: | ||
description: "API Evolution Management Service access token" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout main branch | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: main | ||
path: main | ||
|
||
- name: Checkout current branch | ||
uses: actions/checkout@v2 | ||
with: | ||
path: current | ||
|
||
- name: Check for breaking changes | ||
shell: bash | ||
run: | | ||
before_file_path="${GITHUB_WORKSPACE}/main/${{ inputs.file_path }}" | ||
after_file_path="${GITHUB_WORKSPACE}/current/${{ inputs.file_path }}" | ||
api_url="https://qlq2x2wbi74vc4h6hvjgc5szky0phost.lambda-url.us-east-2.on.aws/" | ||
if [ -f "${before_file_path}" ] && [ -f "${after_file_path}" ]; then | ||
response=$(curl -s -o /dev/null -X POST \ | ||
-w "%{http_code}" \ | ||
"${api_url}" \ | ||
-H "Content-Type: multipart/form-data" \ | ||
-H "Authorization: Bearer ${{ inputs.access_token }}" \ | ||
-F "before=@${before_file_path}" \ | ||
-F "after=@${after_file_path}") | ||
echo "API Evolution Management Service returned an ${response} HTTP status code." | ||
if [ "${response}" -eq 400 ]; then | ||
echo "Breaking changes detected!" | ||
exit 1 | ||
else | ||
echo "No breaking changes detected." | ||
fi | ||
else | ||
echo "File not found in either main or current branch." | ||
fi |