Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ jobs:
openapi-generator-cli --version
exit 1
fi

- name: Run action with name
uses: ./
with:
name: openapi-generator

- name: Check name
run: openapi-generator version
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

🟢 Set up GitHub Actions workflow with [OpenAPI Generator CLI](https://openapi-generator.tech/docs/installation/).

This action installs Java, downloads the OpenAPI Generator CLI JAR, caches it by version, and exposes `openapi-generator-cli` on `PATH`.
This action installs Java, downloads the OpenAPI Generator CLI JAR, caches it by version, and exposes a binary on `PATH`.

## Quick Start

Expand Down Expand Up @@ -52,6 +52,16 @@ See [action.yml](action.yml)
version: 7.21.0
```

### `name`

**Optional**: The OpenAPI Generator CLI binary name. Defaults to `openapi-generator-cli`.

```yaml
- uses: remarkablemark/setup-openapi@v1
with:
name: openapi-generator-cli
```

## License

[MIT](LICENSE)
10 changes: 7 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ inputs:
version:
description: OpenAPI Generator CLI version
default: 7.21.0
name:
description: OpenAPI Generator CLI name
default: openapi-generator-cli

runs:
using: composite
Expand Down Expand Up @@ -53,20 +56,21 @@ runs:
BIN_DIR="$RUNNER_TEMP/openapi-generator-cli-bin"
mkdir -p "$BIN_DIR"

cat > "$BIN_DIR/openapi-generator-cli" <<EOF
cat > "$BIN_DIR/$NAME" <<EOF
#!/usr/bin/env bash
exec java -jar "$JAR_PATH" "\$@"
EOF
chmod +x "$BIN_DIR/openapi-generator-cli"
chmod +x "$BIN_DIR/$NAME"

cat > "$BIN_DIR/openapi-generator-cli.cmd" <<EOF
cat > "$BIN_DIR/$NAME.cmd" <<EOF
@echo off
java -jar "$JAR_PATH" %*
EOF

echo "$BIN_DIR" >> "$GITHUB_PATH"
env:
JAR_PATH: ${{ steps.path.outputs.JAR_PATH }}
NAME: ${{ inputs.name }}

branding:
icon: check-circle
Expand Down
Loading