Skip to content

Commit

Permalink
Add scm.git_user and scm.git_repo configuration properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffano committed Aug 27, 2023
1 parent 38cfc14 commit 88492c1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Added
- Add scm.git_user and scm.git_repo configuration properties

### Changed
- Upgrade OpenAPI Generator to 6.6.0

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Create Swaggy C configuration file called `swaggy-c.yml` with contains the follo
| contact.name | Contact name to be amended to the OpenAPI specification | `John Citizen` |
| contact.url | Contact URL to be amended to the OpenAPI specification | `https://some-app.com` |
| contact.email | Contact email to be amended to the OpenAPI specification | `johnc@some-app.com` |
| scm.git_user | Git user/org name to be amended to the generated OpenAPI Generator configuration | `johncitizen` |
| scm.git_repo | Git repo name to be amended to the generated OpenAPI Generator configuration | `some-app` |
| base_dir.github_actions | Absolute path where the application base directory is located within GitHub Actions runner | `/home/runner/work/some-app/some-app` |
| base_dir.local | Absolute path where the application base directory is located within your local environment | `/Users/some-user/some-path/some-app` |

Expand Down
3 changes: 3 additions & 0 deletions example/swaggy-c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ contact:
name: Cliffano Subagio
url: https://github.com/cliffano/swaggy-c
email: blah@cliffano.com
scm:
git_user: cliffano
git_repo: swaggy-c
base_dir:
github_actions: /home/runner/work/swaggy-c/swaggy-c/example/
local: /Users/cliffano/dev/workspace-studio/swaggy-c/example/
8 changes: 6 additions & 2 deletions src/Makefile-swaggy-c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ CONTACT_NAME ?= $(shell yq .contact.name swaggy-c.yml)
CONTACT_URL ?= $(shell yq .contact.url swaggy-c.yml)
CONTACT_EMAIL ?= $(shell yq .contact.email swaggy-c.yml)

# SCM details to be amended to the OpenAPI Generator configuration .git_* properties
SCM_GIT_USER ?= $(shell yq .scm.git_user swaggy-c.yml)
SCM_GIT_REPO ?= $(shell yq .scm.git_repo swaggy-c.yml)

# APP_BASE_DIR is the absolute path where the application base directory is located, for example:
# - MacOS user workspace directory: /Users/some-user/some-path/some-app
# - GitHub Actions directory: /home/runner/work/some-app/some-app
Expand Down Expand Up @@ -91,11 +95,11 @@ init-spec: stage
fi
yq -i '.info.contact.name = "$(CONTACT_NAME)" | .info.contact.url = "$(CONTACT_URL)" | .info.contact.email = "$(CONTACT_EMAIL)"' "$(LOCAL_SPEC_PATH)"

# Initiailise empty configuration file for all languages
# Initialise basic configuration file for all languages
init-langs-config:
for lang in ${LANGS_ALL} ; do \
mkdir -p clients/$$lang/; \
echo "{}" > clients/$$lang/conf.json; \
echo "{\n \"gitUserId\": \"$(SCM_GIT_USER)\",\n \"gitRepoId\": \"$(SCM_GIT_REPO)\"\n}" > clients/$$lang/conf.json; \
done

# Update Makefile to the latest version on origin's main branch
Expand Down

0 comments on commit 88492c1

Please sign in to comment.