Skip to content

chore(wht): remove unused wht definitions (#1852) #16

chore(wht): remove unused wht definitions (#1852)

chore(wht): remove unused wht definitions (#1852) #16

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_and_raise_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Source Repo
uses: actions/checkout@v4
with:
ref: develop
- name: Checkout Destination Repo
run: |
git clone https://github.com/rudderlabs/rudder-sdk-js.git dest-repo || exit 1
cd dest-repo
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."
echo "pr_required=false" >> $GITHUB_OUTPUT
else
echo "Changes detected."
echo "pr_required=true" >> $GITHUB_OUTPUT
fi
- name: Commit and Push Changes
if: steps.compare_files.outputs.pr_required == 'true'
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 config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf "https://github.com/"
git commit -m "fix: update destinations.ts"
git push origin ${{ env.BRANCH_NAME }}
- name: Create or Update PR
if: steps.compare_files.outputs.pr_required == 'true'
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
cd dest-repo
EXISTING_PR=$(gh pr list --head "$BRANCH_NAME" --json number --jq ".[0].number")
if [ -z "$EXISTING_PR" ]; then
# Create the PR body content in a variable
PR_BODY="This PR updates the destination constants file.
**Changes:**
- Updated \`Destinations.ts\` with latest constants
**NOTE:** This PR was automatically generated by GitHub Actions."
# Create a new PR
gh pr create \
--title "fix: update destination constants" \
--body "$PR_BODY" \
--label "github_actions,dependencies"
else
echo "PR already exists: $EXISTING_PR"
fi