-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (112 loc) · 3.75 KB
/
Copy pathtest-repositories.yml
File metadata and controls
130 lines (112 loc) · 3.75 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# This workflow is provided via the organization template repository
#
# https://github.com/nextcloud/.github
# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
#
# SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: MIT
name: Generate OpenAPI in Repositories
on:
pull_request:
push:
branches:
- main
- master
- stable*
permissions:
contents: read
concurrency:
group: openapi-repositories-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
openapi-repositories:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: [ "8.3" ]
repositories:
- "nextcloud/app_api"
- "nextcloud/app_template"
- "nextcloud/approve_links"
- "nextcloud/assistant"
- "nextcloud/collectives"
- "nextcloud/end_to_end_encryption"
- "nextcloud/files_gcs"
- "nextcloud/files_retention"
- "nextcloud/forms"
- "nextcloud/groupfolders"
- "nextcloud/integration_windmill"
- "nextcloud/mail"
- "nextcloud/notifications"
- "nextcloud/office"
- "nextcloud/password_policy"
- "nextcloud/polls"
- "nextcloud/recommendations"
- "nextcloud/server"
- "nextcloud/spreed"
- "nextcloud/tables"
- "nextcloud/terms_of_service"
- "nextcloud/user_oidc"
name: openapi-repositories
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2.37.2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
ini-file: development
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repository for testing
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
repository: ${{ matrix.repositories }}
path: temp-repository
- name: Install dependencies
run: composer i
- name: Generate OpenAPI
if: matrix.repositories != 'nextcloud/server'
working-directory: temp-repository/
run: ../bin/generate-spec
- name: Generate OpenAPI - Server
if: matrix.repositories == 'nextcloud/server'
working-directory: temp-repository/
run: |
specs=()
for path in core apps/*; do
if [ ! -f "$path/.noopenapi" ]; then
../bin/generate-spec "$path" "$path/openapi.json" || exit 1
if [[ "$(basename "$path")" != "core" ]]; then
if [ -f "$path/openapi-full.json" ]; then
specs+=("$path/openapi-full.json")
else
specs+=("$path/openapi.json")
fi
fi
fi
done
../bin/merge-specs \
--core core/openapi-full.json \
--merged openapi.json \
"${specs[@]}"
- name: Show changes of the API for assistance
working-directory: temp-repository/
run: |
git status
git --no-pager diff
summary:
permissions:
contents: none
runs-on: ubuntu-latest-low
needs: openapi-repositories
if: always()
name: openapi-repositories-summary
steps:
- name: Summary status
run: if ${{ needs.openapi-repositories.result != 'success' && needs.openapi-repositories.result != 'skipped' }}; then exit 1; fi