Skip to content

Commit

Permalink
fix: Fix permissions on SDK generation (#69)
Browse files Browse the repository at this point in the history
Generating the SDK is failing, due to [permissions errors on generated
files](https://github.com/istreamlabs/go-sdk/actions/runs/9504248321).
Seems to be
peter-evans/create-pull-request#783.
  • Loading branch information
lucaspopp-wbd authored Jun 13, 2024
1 parent 99511f6 commit a801e0e
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ jobs:
- name: Re-generate isp
run: ./run.sh

- name: Re-generate isp-slates
- name: Re-generate isp-slate
run: ./run-slate.sh

- name: Detect generated changes
id: changes
run: |
git add isp
git add isp-slate
git status -s
git add isp isp-slate
git status
if [ -n "$(git status -s)" ]; then
echo "should-commit=true" | tee -a "$GITHUB_OUTPUT"
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ _testmain.go
*.prof

isp/api

.DS_Store
14 changes: 12 additions & 2 deletions run-slate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ mkdir isp-slate
cp ./prerequisites/.openapi-generator-ignore ./isp-slate/.openapi-generator-ignore
cp ./prerequisites/convenience._go ./isp-slate/convenience.go
cp ./prerequisites/slates_client._go ./isp-slate/client.go
docker build -t generate-sdk . --no-cache --build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" --build-arg OUT=isp-slate
docker run --rm -v ${SCRIPT_DIR}/isp-slate:/go-sdk/isp-slate generate-sdk

# build sdk generation image
docker build -t generate-sdk . \
--no-cache \
--build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" \
--build-arg OUT=isp-slate

# generate sdk
docker run --rm \
-u "$(id -u):$(id -g)" \
-v ${SCRIPT_DIR}/isp-slate:/go-sdk/isp-slate \
generate-sdk

if [[ "$GITHUB_ACTIONS" = "true" ]]; then
# Logicless templates are dumping extra quotes around enum values, so we've
Expand Down
14 changes: 12 additions & 2 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ mkdir isp
cp ./prerequisites/.openapi-generator-ignore ./isp/.openapi-generator-ignore
cp ./prerequisites/convenience._go ./isp/convenience.go
cp ./prerequisites/client._go ./isp/client.go
docker build -t generate-sdk . --no-cache --build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" --build-arg OUT=isp
docker run --rm -v ${SCRIPT_DIR}/isp:/go-sdk/isp generate-sdk

# build sdk generation image
docker build -t generate-sdk . \
--no-cache \
--build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" \
--build-arg OUT=isp

# generate sdk
docker run --rm \
-u "$(id -u):$(id -g)" \
-v ${SCRIPT_DIR}/isp:/go-sdk/isp \
generate-sdk

if [[ "$GITHUB_ACTIONS" = "true" ]]; then
# Logicless templates are dumping extra quotes around enum values, so we've
Expand Down

0 comments on commit a801e0e

Please sign in to comment.