diff --git a/.github/workflows/delete-pr-branch.yml b/.github/workflows/delete-pr-branch.yml new file mode 100644 index 0000000..62fa59b --- /dev/null +++ b/.github/workflows/delete-pr-branch.yml @@ -0,0 +1,50 @@ +name: Delete PR Branch On Close + +on: + pull_request: + types: + - closed + +permissions: + contents: write + pull-requests: read + +jobs: + delete-branch: + runs-on: gitops_runner + if: >- + github.event.pull_request.merged == true + + steps: + - name: Delete branch via Gitea API + shell: bash + env: + TOKEN: ${{ secrets.GITEA_TOKEN }} + REPOSITORY: ${{ github.repository }} + BRANCH: ${{ github.event.pull_request.head.ref }} + API_BASE: ${{ GITHUB_API_URL }} + run: | + set -euo pipefail + + # Branch names commonly include '/'; encode it for the API path segment. + BRANCH_ENCODED="${BRANCH//\//%2F}" + URL="${API_BASE}/repos/${REPOSITORY}/branches/${BRANCH_ENCODED}" + + RESPONSE_FILE="$(mktemp)" + STATUS="$(curl -sS -o "${RESPONSE_FILE}" -w "%{http_code}" \ + -X DELETE \ + -H "Authorization: token ${TOKEN}" \ + -H "Accept: application/json" \ + "${URL}")" + + if [ "${STATUS}" = "204" ]; then + echo "Deleted branch: ${BRANCH}" + elif [ "${STATUS}" = "404" ]; then + echo "Branch already deleted or missing: ${BRANCH}" + else + echo "Branch deletion failed with HTTP ${STATUS}" + cat "${RESPONSE_FILE}" + exit 1 + fi + + diff --git a/nowchess/base/nowchess-env-config.yaml b/nowchess/base/nowchess-env-config.yaml index c15bcff..0ee2f2d 100644 --- a/nowchess/base/nowchess-env-config.yaml +++ b/nowchess/base/nowchess-env-config.yaml @@ -3,7 +3,8 @@ kind: ConfigMap metadata: name: nowchess-env-config data: - QUARKUS_PROFILE: staging,deployed + QUARKUS_PROFILE: deployed CORS_ORIGINS: "" NOWCHESS_COORDINATOR_ENABLED: "true" REDIS_PREFIX: nowchess-staging + QUARKUS_LOG_LEVEL: "INFO" diff --git a/nowchess/eu-central-1-prod/kustomization.yaml b/nowchess/eu-central-1-prod/kustomization.yaml index dbe4303..70c46f2 100644 --- a/nowchess/eu-central-1-prod/kustomization.yaml +++ b/nowchess/eu-central-1-prod/kustomization.yaml @@ -11,10 +11,11 @@ patches: metadata: name: nowchess-env-config data: - QUARKUS_PROFILE: production,deployed + QUARKUS_PROFILE: deployed CORS_ORIGINS: https://nowchess.janis-eccarius.de NOWCHESS_COORDINATOR_ENABLED: "true" REDIS_PREFIX: nowchess + QUARKUS_LOG_LEVEL: "WARN" target: kind: ConfigMap name: nowchess-env-config diff --git a/nowchess/eu-central-1-staging/kustomization.yaml b/nowchess/eu-central-1-staging/kustomization.yaml index d79ffd1..d73cf4f 100644 --- a/nowchess/eu-central-1-staging/kustomization.yaml +++ b/nowchess/eu-central-1-staging/kustomization.yaml @@ -15,6 +15,7 @@ patches: CORS_ORIGINS: https://st.nowchess.janis-eccarius.de NOWCHESS_COORDINATOR_ENABLED: "true" REDIS_PREFIX: nowchess-staging + QUARKUS_LOG_LEVEL: "INFO" target: kind: ConfigMap name: nowchess-env-config