forked from inaka/cowboy_swagger
-
Notifications
You must be signed in to change notification settings - Fork 2
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 #3 from id/20241217-sync-upstream
sync upstream
- Loading branch information
Showing
60 changed files
with
1,739 additions
and
1,718 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
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,52 @@ | ||
#!/bin/bash | ||
|
||
set -eux | ||
|
||
# Get Swagger UI version and compare to imported one. Exit if same... | ||
npm install swagger-ui-dist | ||
rm -f package-lock.json | ||
rm -f package.json | ||
NEW_SWAGGER_VSN=$(jq -r .version <node_modules/swagger-ui-dist/package.json) | ||
OLD_SWAGGER_VSN=$(cat SWAGGER_VSN) | ||
|
||
if [[ "${NEW_SWAGGER_VSN}" = "${OLD_SWAGGER_VSN}" ]]; then | ||
# no change | ||
exit | ||
fi | ||
|
||
# Swagger UI version is different from imported one. Update... | ||
rm -rf priv/swagger | ||
mkdir -p priv/swagger | ||
mv -f node_modules/swagger-ui-dist/* priv/swagger | ||
rm -rf node_modules | ||
|
||
# Same as https://github.com/swagger-api/swagger-ui/blob/63ad6f6a5bce19075e717ea74acaf9f7055dcdf5/docker/docker-entrypoint.d/40-swagger-ui.sh#L12 | ||
FIND="\"https://petstore.swagger.io/v2/swagger.json\"" | ||
REPLACE="window.location.origin + \"/api-docs/swagger.json\"" | ||
sed -i -e "s|${FIND}|${REPLACE}|g" priv/swagger/swagger-initializer.js | ||
|
||
echo "${NEW_SWAGGER_VSN}" >SWAGGER_VSN | ||
|
||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
|
||
BRANCH=feature/swagger-ui-update | ||
|
||
if git show-ref --verify --quiet "refs/heads/${BRANCH}"; then | ||
# already exists | ||
exit | ||
fi | ||
|
||
git fetch origin | ||
git checkout -b "${BRANCH}" | ||
|
||
if ! git diff --exit-code 1>/dev/null; then | ||
# there's stuff to push | ||
git add . | ||
git commit -m "Update Swagger UI to ${NEW_SWAGGER_VSN}" | ||
git push origin "${BRANCH}" | ||
|
||
gh pr create --fill \ | ||
--title "Update Swagger UI to ${NEW_SWAGGER_VSN} (automation)" \ | ||
--body "This is an automated action to update the repository's Swagger UI version" | ||
fi |
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,18 @@ | ||
--- | ||
name: Swagger UI | ||
|
||
"on": | ||
schedule: | ||
- cron: '0 12 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update: | ||
name: Update | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
./.github/workflows/up_swagger.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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 |
---|---|---|
@@ -1,21 +1,6 @@ | ||
_rel/ | ||
relx | ||
*.d | ||
.eunit | ||
/deps | ||
*.o | ||
*.beam | ||
*.plt | ||
_* | ||
erl_crash.dump | ||
ebin | ||
rel/example_project | ||
.concrete/DEV_MODE | ||
.rebar | ||
.erlang.mk | ||
log | ||
doc/ | ||
.rebar3 | ||
logs | ||
doc | ||
_build | ||
.rebar3/ | ||
example/compile_commands.json | ||
example/_checkouts/ |
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,2 @@ | ||
jshint: | ||
config_file: .jshintrc |
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,4 @@ | ||
{ | ||
"asi": true, | ||
"esversion": 6 | ||
} |
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 @@ | ||
5.17.14 |
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 |
---|---|---|
@@ -1,27 +1,15 @@ | ||
[ | ||
{ | ||
elvis, | ||
[ | ||
{config, | ||
[#{dirs => ["src", "test"], | ||
filter => "*.erl", | ||
ruleset => erl_files | ||
}, | ||
#{dirs => ["."], | ||
filter => "Makefile", | ||
rules => [{elvis_project, protocol_for_deps_erlang_mk, #{regex => "(https://.*|[0-9]+([.][0-9]+)*)"}}], | ||
ruleset => makefiles | ||
}, | ||
#{dirs => ["."], | ||
filter => "rebar.config", | ||
ruleset => rebar_config | ||
}, | ||
#{dirs => ["."], | ||
filter => "elvis.config", | ||
ruleset => elvis_config | ||
} | ||
] | ||
} | ||
] | ||
} | ||
]. | ||
[{elvis, | ||
[{config, | ||
[#{dirs => ["src", "test"], | ||
filter => "*.erl", | ||
ruleset => erl_files, | ||
rules => | ||
[{elvis_style, | ||
atom_naming_convention, | ||
#{regex => "^(([a-z][a-z0-9]*_?)*(_SUITE)?|basePath|swagger_2_0|openapi_3_0_0)$"}}]}, | ||
#{dirs => ["."], | ||
filter => "rebar.config", | ||
ruleset => rebar_config}, | ||
#{dirs => ["."], | ||
filter => "elvis.config", | ||
ruleset => elvis_config}]}]}]. |
Oops, something went wrong.