-
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.52 KB
/
openapi-generator.yml
File metadata and controls
69 lines (59 loc) · 2.52 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
62
63
64
65
66
67
68
69
name: openapi-generator
on:
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.4"
tools: composer:v2
- name: Install Dependencies
run: composer install --no-interaction --prefer-dist --optimize-autoloader
- name: Install OpenAPI Generator CLI
run: npm install -g @openapitools/openapi-generator-cli
- name: Run OpenAPI Generator
run: composer run generate_openapi
- name: Check for changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
echo "Changes detected after OpenAPI generation"
git status --porcelain
else
echo "changed=false" >> $GITHUB_OUTPUT
echo "No changes detected after OpenAPI generation"
fi
- name: Commit and Push changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
BRANCH_NAME="openapi-updates-$(date +%s)"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b $BRANCH_NAME
git add -A
git commit -m "Update OpenAPI generated files"
git push origin $BRANCH_NAME
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
id: commit
- name: Create Pull Request
if: steps.verify-changed-files.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--title "Update OpenAPI generated files" \
--body "This PR contains updates to the OpenAPI generated files.
Generated by running \`composer run generate_open_api\`." \
--base main \
--head ${{ steps.commit.outputs.branch_name }} \
--label automated,openapi