From 9a1625fa1b62d7f7a6fc51323634885516bd8689 Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Wed, 11 Jun 2025 13:15:42 -0500 Subject: [PATCH 1/4] Enforce PR Source --- .github/workflows/enforce-pr-source.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/enforce-pr-source.yml diff --git a/.github/workflows/enforce-pr-source.yml b/.github/workflows/enforce-pr-source.yml new file mode 100644 index 00000000..eec6cf73 --- /dev/null +++ b/.github/workflows/enforce-pr-source.yml @@ -0,0 +1,19 @@ +name: Enforce PR Source + +on: + pull_request: + branches: + - main + +jobs: + check-pr-source: + runs-on: ubuntu-latest + steps: + - name: Enforce only staging → main + run: | + echo "head_ref: ${{ github.head_ref }}" + echo "base_ref: ${{ github.base_ref }}" + if [[ "${{ github.head_ref }}" != "staging" ]]; then + echo "ERROR: Only 'staging' branch may create PRs into 'main'!" + exit 1 + fi From 51257bbde8dabc342a1712dc632e99794890de2f Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Wed, 11 Jun 2025 13:20:29 -0500 Subject: [PATCH 2/4] Backup Database Skript --- backup-database.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backup-database.bash b/backup-database.bash index dca6ef52..fc8a5f08 100644 --- a/backup-database.bash +++ b/backup-database.bash @@ -13,13 +13,13 @@ export AWS_RESPONSE_CHECKSUM_VALIDATION=when_required # Den Key dafür findet man auf https://dcd.ionos.com/latest/?lang=en#/key-management docker exec -t online-energieausweis-database-1 pg_dump --data-only -U main main | brotli --best > $FILE_NAME -aws s3 cp $FILE_NAME s3://ibc-db-backup/ --profile ionos --endpoint-url https://s3-eu-central-1.ionoscloud.com --storage-class STANDARD +aws s3 cp $FILE_NAME s3://ibc-db-backup/ --profile ionos --endpoint-url https://s3.eu-central-3.ionoscloud.com --storage-class STANDARD echo "Uploaded $FILE_NAME" docker exec -t online-energieausweis-database-1 pg_dumpall -c -U main | brotli --best > $FILE_NAME_COMPLETE -aws s3 cp $FILE_NAME_COMPLETE s3://ibc-db-backup/ --profile ionos --endpoint-url https://s3-eu-central-1.ionoscloud.com --storage-class STANDARD +aws s3 cp $FILE_NAME_COMPLETE s3://ibc-db-backup/ --profile ionos --endpoint-url https://s3-eu-central-3.ionoscloud.com --storage-class STANDARD echo "Uploaded $FILE_NAME_COMPLETE" From 50f36dbc6ce6a78b3bc0a5326a559bd1df7fd2a0 Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Wed, 11 Jun 2025 13:38:54 -0500 Subject: [PATCH 3/4] Workflow --- .github/workflows/enforce-pr-source.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/enforce-pr-source.yml b/.github/workflows/enforce-pr-source.yml index eec6cf73..4409e425 100644 --- a/.github/workflows/enforce-pr-source.yml +++ b/.github/workflows/enforce-pr-source.yml @@ -2,6 +2,7 @@ name: Enforce PR Source on: pull_request: + types: [opened, synchronize, reopened, ready_for_review] branches: - main @@ -11,8 +12,6 @@ jobs: steps: - name: Enforce only staging → main run: | - echo "head_ref: ${{ github.head_ref }}" - echo "base_ref: ${{ github.base_ref }}" if [[ "${{ github.head_ref }}" != "staging" ]]; then echo "ERROR: Only 'staging' branch may create PRs into 'main'!" exit 1 From 042bad25e0ee24479ad3b6ec0b35912b3b1241b4 Mon Sep 17 00:00:00 2001 From: Moritz Utcke Date: Wed, 11 Jun 2025 13:42:46 -0500 Subject: [PATCH 4/4] Remove old check --- .github/workflows/prevent-wrong-pr.yml | 27 -------------------------- 1 file changed, 27 deletions(-) delete mode 100644 .github/workflows/prevent-wrong-pr.yml diff --git a/.github/workflows/prevent-wrong-pr.yml b/.github/workflows/prevent-wrong-pr.yml deleted file mode 100644 index 1cbfebf3..00000000 --- a/.github/workflows/prevent-wrong-pr.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: PR Rules Enforcement - -on: - pull_request: - branches: - - main - - staging - -jobs: - check-pr: - runs-on: ubuntu-latest - name: Validate Pull Request Sources - steps: - - name: Prevent dev merges - run: | - if [[ "${{ github.head_ref }}" == "dev" && "${{ github.base_ref }}" == "main" ]]; then - echo "ERROR: Merging 'dev' into '${{ github.base_ref }}' is forbidden!" - exit 1 - fi - - - name: Allow only staging into main - if: github.base_ref == 'main' - run: | - if [[ "${{ github.head_ref }}" != "staging" ]]; then - echo "ERROR: Only 'staging' branch is allowed to merge into 'main'. Current: '${{ github.head_ref }}'" - exit 1 - fi