-
-
Notifications
You must be signed in to change notification settings - Fork 196
61 lines (51 loc) · 2.06 KB
/
Copy pathswagger-ui-update.yml
File metadata and controls
61 lines (51 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Swagger UI Update
"on":
schedule:
- cron: "0 8 * * 1"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- name: Check latest Swagger UI release
id: swagger-ui
env:
GH_TOKEN: ${{ github.token }}
run: |
current_version="$(ruby -r ./lib/grape-swagger-rails/version -e 'print GrapeSwaggerRails::SWAGGER_UI_VERSION')"
latest_tag="$(gh api repos/swagger-api/swagger-ui/releases/latest --jq .tag_name)"
latest_version="${latest_tag#v}"
echo "current-version=${current_version}" >> "$GITHUB_OUTPUT"
echo "latest-tag=${latest_tag}" >> "$GITHUB_OUTPUT"
echo "latest-version=${latest_version}" >> "$GITHUB_OUTPUT"
if [ "$current_version" != "$latest_version" ]; then
echo "update-needed=true" >> "$GITHUB_OUTPUT"
else
echo "update-needed=false" >> "$GITHUB_OUTPUT"
fi
- name: Update Swagger UI assets
if: steps.swagger-ui.outputs.update-needed == 'true'
env:
SWAGGER_UI_VERSION: ${{ steps.swagger-ui.outputs.latest-tag }}
run: bundle exec rake swagger_ui:dist:update
- name: Create pull request
if: steps.swagger-ui.outputs.update-needed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ github.token }}
branch: update-swagger-ui-${{ steps.swagger-ui.outputs.latest-version }}
delete-branch: true
commit-message: Bump Swagger UI to ${{ steps.swagger-ui.outputs.latest-version }}
title: Bump Swagger UI to ${{ steps.swagger-ui.outputs.latest-version }}
body: |
Updates bundled Swagger UI assets from swagger-api/swagger-ui `${{ steps.swagger-ui.outputs.latest-tag }}`.
Generated by the scheduled Swagger UI update workflow.