diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index b6d021c80..d8c40f7ac 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -32,6 +32,8 @@ jobs: run: | if [ -n "$(git status --porcelain)" ]; then echo "::error::Generated constants are not up-to-date. Run 'npm run generate:constants' and commit the changes."; + echo "Here are the differences:"; + git diff || true 2>&1; exit 1; else echo "Git state is clean."; diff --git a/.github/workflows/raise-pr-for-constants.yml b/.github/workflows/raise-pr-for-constants.yml new file mode 100644 index 000000000..c509f166a --- /dev/null +++ b/.github/workflows/raise-pr-for-constants.yml @@ -0,0 +1,80 @@ +name: Raise PR for Destination Constants + +on: + push: + branches: + - develop + +permissions: + contents: write + pull-requests: write + +env: + BRANCH_NAME: fix/gh-update-destinations-ts + SRC_FILE: generated/Destinations.ts + DEST_PATH: packages/analytics-js-common/src/constants/integrations/Destinations.ts + +jobs: + check_changes: + runs-on: ubuntu-latest + outputs: + pr_required: ${{ steps.compare_files.outputs.pr_required }} + steps: + - name: Checkout Source Repo + uses: actions/checkout@v4 + with: + ref: develop + + - name: Checkout Destination Repo + run: | + DEST_REPO="rudderlabs/rudder-sdk-js" + git clone https://github.com/${DEST_REPO}.git dest-repo || exit 1 + cd dest-repo + git config --global user.name "GitHub Actions" + git config --global user.email "noreply@github.com" + git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/" + git checkout ${{ env.BRANCH_NAME }} || git checkout -b ${{ env.BRANCH_NAME }} + + - name: Compare Destinations.ts + id: compare_files + run: | + if cmp -s "${{ env.SRC_FILE }}" "dest-repo/${{ env.DEST_PATH }}"; then + echo "No changes detected." > "result.txt" + echo "pr_required=false" >> $GITHUB_OUTPUT + else + echo "Changes detected." > "result.txt" + echo "pr_required=true" >> $GITHUB_OUTPUT + fi + + raise_pr: + needs: check_changes + if: needs.check_changes.outputs.pr_required == 'true' + runs-on: ubuntu-latest + steps: + - name: Commit and Push Changes + run: | + cd dest-repo + cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts" + git add packages/analytics-js-common/src/constants/integrations/Destinations.ts + git commit -m "fix: update destinations.ts" + git push origin ${{ env.BRANCH_NAME }} + + - name: Create or Update PR + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd dest-repo + EXISTING_PR=$(gh pr list --head ${{ env.BRANCH_NAME }} --json number --jq ".[0].number") + if [ -z "$EXISTING_PR" ]; then + gh pr create \ + --title "fix: update destination constants" \ + --body "This PR updates the destination constants file. + + **Changes:** + - Updated \`Destinations.ts\` with latest constants + + This PR was automatically generated by GitHub Actions." \ + --label "automated,dependencies" + else + echo "PR already exists: $EXISTING_PR" + fi diff --git a/generated/Destinations.dart b/generated/Destinations.dart index 9c2159fb5..be0ef7a06 100644 --- a/generated/Destinations.dart +++ b/generated/Destinations.dart @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.dart.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ class Destinations { diff --git a/generated/Destinations.java b/generated/Destinations.java index b1d57fd79..092d09b2c 100644 --- a/generated/Destinations.java +++ b/generated/Destinations.java @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.java.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ public class Destinations { diff --git a/generated/Destinations.kt b/generated/Destinations.kt index d26980292..02178de38 100644 --- a/generated/Destinations.kt +++ b/generated/Destinations.kt @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.kt.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ object Destinations { diff --git a/generated/Destinations.m b/generated/Destinations.m index c0b98180b..1bf83b059 100644 --- a/generated/Destinations.m +++ b/generated/Destinations.m @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.m.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m - NOTE: Containly only constants for device mode destinations */ + NOTE: Contains only constants for device mode destinations */ #import diff --git a/generated/Destinations.swift b/generated/Destinations.swift index 368d890df..cd9694920 100644 --- a/generated/Destinations.swift +++ b/generated/Destinations.swift @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.swift.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ struct Destinations { diff --git a/generated/Destinations.ts b/generated/Destinations.ts index e97f1016c..a764b822c 100644 --- a/generated/Destinations.ts +++ b/generated/Destinations.ts @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.ts.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ export const ACTIVE_CAMPAIGN_NAME = 'ACTIVE_CAMPAIGN'; export const ACTIVE_CAMPAIGN_DISPLAY_NAME = 'ActiveCampaign'; diff --git a/templates/Destinations.dart.template b/templates/Destinations.dart.template index f78f19489..9b6b5b615 100644 --- a/templates/Destinations.dart.template +++ b/templates/Destinations.dart.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.dart.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.dart - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ class Destinations { diff --git a/templates/Destinations.java.template b/templates/Destinations.java.template index 941f2cebc..b1cb12bb0 100644 --- a/templates/Destinations.java.template +++ b/templates/Destinations.java.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.java.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.java - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ public class Destinations { diff --git a/templates/Destinations.kt.template b/templates/Destinations.kt.template index 66feb5340..c6ca2a5cb 100644 --- a/templates/Destinations.kt.template +++ b/templates/Destinations.kt.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.kt.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.kt - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ object Destinations { diff --git a/templates/Destinations.m.template b/templates/Destinations.m.template index 3c091322e..0b53a7c8c 100644 --- a/templates/Destinations.m.template +++ b/templates/Destinations.m.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.m.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.m - NOTE: Containly only constants for device mode destinations */ + NOTE: Contains only constants for device mode destinations */ #import diff --git a/templates/Destinations.swift.template b/templates/Destinations.swift.template index 735c26006..a0af3a6e6 100644 --- a/templates/Destinations.swift.template +++ b/templates/Destinations.swift.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.swift.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.swift - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ struct Destinations { diff --git a/templates/Destinations.ts.template b/templates/Destinations.ts.template index 30b567063..582562b0e 100644 --- a/templates/Destinations.ts.template +++ b/templates/Destinations.ts.template @@ -1,9 +1,9 @@ /* GENERATED - DO NOT EDIT This file is generated from the templates/Destinations.ts.template file. - Orginal file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts + Original file: https://github.com/rudderlabs/rudder-integrations-config/blob/develop/generated/Destinations.ts - NOTE: Containly only constants for device mode destinations + NOTE: Contains only constants for device mode destinations */ ${ destinations.map((dest) =>