diff --git a/.github/workflows/regenerate-connector-template.yml b/.github/workflows/regenerate-connector-template.yml index be6a07e3..76c4627b 100644 --- a/.github/workflows/regenerate-connector-template.yml +++ b/.github/workflows/regenerate-connector-template.yml @@ -127,7 +127,7 @@ jobs: echo "Unsupported file extension: ${{ inputs.openapi-url }}" exit 1 fi - + - name: Read File Extension working-directory: docs/spec run: | @@ -135,6 +135,14 @@ jobs: ext="${file##*.}" echo "EXTENSION=$ext" >> "$GITHUB_ENV" + - name: Checkout or Create Branch + run: | + if git show-ref --verify --quiet refs/heads/regenerate-connector; then + git checkout regenerate-connector + else + git checkout -b regenerate-connector + fi + - name: Flatten OpenAPI Specification if: ${{ inputs.flatten-openapi }} working-directory: docs/spec @@ -169,11 +177,9 @@ jobs: - name: Commit Files id: commitFiles run: | - git checkout -b regenerate-connector - changed=false # First commit: OpenAPI spec changes - git add docs/spec/ + git add docs/spec/ if ! git diff --cached --quiet; then git commit -m "[AUTOMATED] Update OpenAPI spec" changed=true diff --git a/regenerate-openapi-connectors/main.bal b/regenerate-openapi-connectors/main.bal index 4636fc41..9d801aad 100644 --- a/regenerate-openapi-connectors/main.bal +++ b/regenerate-openapi-connectors/main.bal @@ -69,7 +69,6 @@ public function main() returns error? { printError(modules); return modules; } - modules.forEach((m) => io:println(m.name)); ProcessingModule[] processingModules = []; if modules.length() == 0 { return; @@ -141,7 +140,6 @@ isolated function triggerModuleRegeneration(Module m) returns int|error { if branchResult is github:BranchWithProtection { string message = string `Branch ${REGENERATION_BRANCH} already exists for module: ${m.name}`; printInfo(message); - return error(message); } error? dispatchResult = github->/repos/[GITHUB_ORG]/[m.name]/actions/workflows/[workflow]/dispatches.post(payload);