-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14366 from nextcloud/fix/noid/core-types
- Loading branch information
Showing
11 changed files
with
7,201 additions
and
137 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,80 @@ | ||
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
name: Update nextcloud/openapi | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "5 4 * * 0" | ||
|
||
jobs: | ||
update-nextcloud-openapi: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
branches: ['main', 'master', 'stable31', 'stable30'] | ||
|
||
name: Update Nextcloud OpenAPI types from core | ||
|
||
steps: | ||
- name: Set app env | ||
run: | | ||
# Split and keep last | ||
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV | ||
- name: Checkout server | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
with: | ||
submodules: true | ||
repository: nextcloud/server | ||
ref: ${{ matrix.server-versions }} | ||
|
||
- name: Checkout app | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | ||
with: | ||
path: apps/${{ env.APP_NAME }} | ||
ref: ${{ matrix.branches }} | ||
|
||
- name: Read package.json node and npm engines version | ||
uses: skjnldsv/read-package-engines-version-actions@06d6baf7d8f41934ab630e97d9e6c0bc9c9ac5e4 # v3 | ||
id: versions | ||
with: | ||
fallbackNode: '^20' | ||
fallbackNpm: '^10' | ||
|
||
- name: Set up node ${{ steps.versions.outputs.nodeVersion }} | ||
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | ||
with: | ||
node-version: ${{ steps.versions.outputs.nodeVersion }} | ||
|
||
- name: Set up npm ${{ steps.versions.outputs.npmVersion }} | ||
run: npm i -g 'npm@${{ steps.versions.outputs.npmVersion }}' | ||
|
||
- name: Install dependencies & generate types | ||
working-directory: apps/${{ env.APP_NAME }} | ||
env: | ||
CYPRESS_INSTALL_BINARY: 0 | ||
PUPPETEER_SKIP_DOWNLOAD: true | ||
run: | | ||
npm ci | ||
npm run typescript:generate-core-types --if-present | ||
- name: Create Pull Request | ||
if: steps.checkout.outcome == 'success' | ||
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 | ||
with: | ||
token: ${{ secrets.COMMAND_BOT_PAT }} | ||
commit-message: 'chore(ts): update OpenAPI types from core' | ||
committer: GitHub <noreply@github.com> | ||
author: nextcloud-command <nextcloud-command@users.noreply.github.com> | ||
signoff: true | ||
branch: 'automated/noid/${{ matrix.branches }}-update-nextcloud-openapi' | ||
title: '[${{ matrix.branches }}] Update Nextcloud OpenAPI types' | ||
body: | | ||
Auto-generated update of Nextcloud OpenAPI types | ||
labels: | | ||
dependencies | ||
3. to review |
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
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
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
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
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,40 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
# | ||
|
||
# By default is expected that pwd returns <server_directory>/<apps or apps-extra>/spreed | ||
SERVER_DIR="${1:-$(dirname $(dirname $(pwd)))}" | ||
TYPES_DIR="$(pwd)/src/types" | ||
CORE_TYPES_OUTPUT_DIR="$TYPES_DIR/openapi/core" | ||
TEMP_DIR="$TYPES_DIR/tmp" | ||
|
||
# Create the temporary directory if it doesn't exist | ||
mkdir -p "$CORE_TYPES_OUTPUT_DIR" | ||
mkdir -p "$TEMP_DIR" | ||
|
||
# Find and copy openapi.json files, then translate to ts types | ||
generate_ts_files() { | ||
local full_path=$1 | ||
local file_name=$2 | ||
local openapi_file="$SERVER_DIR/$full_path/$file_name" | ||
local temp_file="$TEMP_DIR/openapi_${full_path#apps/}.json" | ||
local ts_file="$CORE_TYPES_OUTPUT_DIR/openapi_${full_path#apps/}.ts" | ||
|
||
if [ -f "$openapi_file" ]; then | ||
cp "$openapi_file" "$temp_file" | ||
else | ||
echo "Error: $openapi_file is not found" | ||
return 1 | ||
fi | ||
|
||
npx openapi-typescript --redocly $TYPES_DIR "$temp_file" -t -o "$ts_file" | ||
} | ||
|
||
generate_ts_files "core" "openapi.json" | ||
generate_ts_files "apps/files_sharing" "openapi.json" | ||
generate_ts_files "apps/dav" "openapi.json" | ||
generate_ts_files "apps/provisioning_api" "openapi.json" | ||
|
||
rm -rf "$TEMP_DIR" |
Oops, something went wrong.