Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add gh workflow for raising pr for constants #1832

Merged
merged 4 commits into from
Dec 10, 2024

Conversation

koladilip
Copy link
Collaborator

@koladilip koladilip commented Dec 9, 2024

What are the changes introduced in this PR?

raise PR when constant files are changed

What is the related Linear task?

Resolves INT-2930

Please explain the objectives of your changes below

Put down any required details on the broader aspect of your changes. If there are any dependent changes, mandatorily mention them here

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

N/A

Any new dependencies introduced with this change?

N/A

Any new checks got introduced or modified in test suites. Please explain the changes.

N/A


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • I have executed schemaGenerator tests and updated schema if needed

  • Are sensitive fields marked as secret in definition config?

  • My test cases and placeholders use only masked/sample values for sensitive fields

  • Is the PR limited to 10 file changes & one task?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

Summary by CodeRabbit

  • New Features
    • Introduced a new GitHub Actions workflow to automate raising pull requests for updates to destination constants.
  • Bug Fixes
    • Corrected minor textual errors in comments across multiple template files for clarity and accuracy.
  • Documentation
    • Enhanced feedback in the GitHub Actions workflow to indicate differences in generated constants when outdated.

Copy link

coderabbitai bot commented Dec 9, 2024

Walkthrough

The pull request introduces enhancements to GitHub Actions workflows related to managing generated constants. A new workflow file, raise-pr-for-constants.yml, automates the process of raising pull requests for updates to destination constants upon pushes to the develop branch. Additionally, the existing workflow in check-generated.yml has been modified to provide clearer output of differences in generated constants. Minor textual corrections have been made across various template files to improve documentation clarity.

Changes

File Path Change Summary
.github/workflows/check-generated.yml Added an echo command to output differences in generated constants if they are outdated.
.github/workflows/raise-pr-for-constants.yml Introduced a new workflow to automate raising pull requests for updates to destination constants based on file changes.
templates/Destinations.dart.template Corrected "Orginal" to "Original" and "Containly" to "Contains" in comments.
templates/Destinations.java.template Corrected "Orginal" to "Original" and "Containly" to "Contains" in comments.
templates/Destinations.kt.template Corrected "Orginal" to "Original" and "Containly" to "Contains" in comments.
templates/Destinations.m.template Corrected "Orginal" to "Original" and "Containly" to "Contains" in comments.
templates/Destinations.swift.template Corrected "Orginal" to "Original" and "Containly" to "Contains" in comments.
templates/Destinations.ts.template Corrected "Orginal" to "Original" and "Containly" to "Contains" in comments.

Possibly related PRs

  • chore: add generate constant script to pre commit #1821: The changes in this PR involve modifications to the .github/workflows/check-generated.yml file, which is directly related to the enhancements made in the main PR to improve the feedback on generated constants. Both PRs focus on the GitHub Actions workflow for managing generated files.

Suggested reviewers

  • lvrach
  • RanjeetMishra
  • shrouti1507
  • ItsSudip
  • saikumarrs
  • sandeepdsvs
  • krishna2020
  • sanpj2292

🐇 In the land of code, where rabbits roam,
New workflows sprout, making changes at home.
With comments corrected, clarity's bright,
Pull requests are raised, all set for flight!
Hopping through branches, we cheer with delight,
For constants and changes, our future looks bright! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d0258b1) to head (a5331ee).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff            @@
##           develop     #1832   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines           53        53           
  Branches         7         7           
=========================================
  Hits            53        53           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Outside diff range and nitpick comments (2)
.github/workflows/raise-pr-for-constants.yml (2)

34-45: Enhance error handling and file validation

The script should validate file existence and handle potential errors more robustly.

Consider adding:

 run: |
+          if [ ! -f "$SRC_FILE" ]; then
+            echo "Error: Source file $SRC_FILE not found"
+            exit 1
+          fi
+
+          if [ ! -f "dest-repo/$DEST_PATH" ]; then
+            echo "Error: Destination file not found"
+            exit 1
+          fi
+
           if cmp -s "$SRC_FILE" "dest-repo/$DEST_PATH"; then
🧰 Tools
🪛 actionlint (1.7.4)

34-34: shellcheck reported issue in this script: SC2034:warning:2:1: DEST_REPO appears unused. Verify use (or export if used externally)

(shellcheck)


34-34: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


34-34: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


62-67: Add PR title and body for better context

The current PR creation lacks descriptive information.

Consider enhancing the PR creation:

           if [ -z "$EXISTING_PR" ]; then
-            gh pr create -f
+            gh pr create \
+              --title "chore: update destination constants" \
+              --body "This PR updates the destination constants file.
+
+              - Auto-generated by GitHub Actions
+              - Source: rudderlabs/rudder-integrations-config
+              " \
+              --label "automated,constants"
           else
             echo "PR already exists: $EXISTING_PR"
           fi
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d0258b1 and 5ba6d5c.

⛔ Files ignored due to path filters (7)
  • generated/Destinations.dart is excluded by !**/generated/**
  • generated/Destinations.java is excluded by !**/generated/**
  • generated/Destinations.js is excluded by !**/generated/**
  • generated/Destinations.kt is excluded by !**/generated/**
  • generated/Destinations.m is excluded by !**/generated/**
  • generated/Destinations.swift is excluded by !**/generated/**
  • generated/Destinations.ts is excluded by !**/generated/**
📒 Files selected for processing (8)
  • .github/workflows/check-generated.yml (1 hunks)
  • .github/workflows/raise-pr-for-constants.yml (1 hunks)
  • templates/Destinations.dart.template (1 hunks)
  • templates/Destinations.java.template (1 hunks)
  • templates/Destinations.kt.template (1 hunks)
  • templates/Destinations.m.template (1 hunks)
  • templates/Destinations.swift.template (1 hunks)
  • templates/Destinations.ts.template (1 hunks)
✅ Files skipped from review due to trivial changes (6)
  • templates/Destinations.ts.template
  • templates/Destinations.dart.template
  • templates/Destinations.swift.template
  • templates/Destinations.kt.template
  • templates/Destinations.m.template
  • templates/Destinations.java.template
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/raise-pr-for-constants.yml

34-34: shellcheck reported issue in this script: SC2034:warning:2:1: DEST_REPO appears unused. Verify use (or export if used externally)

(shellcheck)


34-34: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


34-34: workflow command "set-output" was deprecated. use echo "{name}={value}" >> $GITHUB_OUTPUT instead: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions

(deprecated-commands)


48-48: if: condition "${{ needs.check_changes.outputs.pr_required }} == 'true'" is always evaluated to true because extra characters are around ${{ }}

(if-cond)

🔇 Additional comments (2)
.github/workflows/check-generated.yml (1)

35-36: Great addition to improve developer feedback!

The addition of git diff output will help developers quickly understand what changes need to be committed, improving the workflow's usability.

.github/workflows/raise-pr-for-constants.yml (1)

24-24: Verify repository access permissions

Ensure that the PAT has the necessary permissions to access both repositories and that the destination repository allows workflow-created PRs.

✅ Verification successful

Let me gather more information about the workflow configuration and permissions.


Repository access is properly configured with necessary permissions

The workflow is correctly set up with:

  • Uses PAT secret for authentication (${{ secrets.PAT }})
  • Has proper git configuration for commits
  • Implements PR creation using GitHub CLI
  • Target repository (rudderlabs/rudder-sdk-js) is public and active
  • Includes proper error handling for branch operations
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the destination repository exists and is accessible
gh repo view rudderlabs/rudder-sdk-js --json name,visibility,isArchived

# Check if there are any existing PRs from this workflow
gh pr list -R rudderlabs/rudder-sdk-js \
  --search "author:app/github-actions in:title update destination constants" \
  --json number,title,state

Length of output: 284


Script:

#!/bin/bash
# Check the workflow configuration for permissions and token usage
cat .github/workflows/raise-pr-for-constants.yml

# Check if there are any other workflows that interact with the same repository
rg -l "rudderlabs/rudder-sdk-js" .github/workflows/

Length of output: 2420

.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
@koladilip koladilip force-pushed the chore/add-pr-raiser-workflow branch from 5ba6d5c to f2219b0 Compare December 9, 2024 18:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (1)
.github/workflows/raise-pr-for-constants.yml (1)

12-14: Consider using a dynamic branch name.

The hardcoded branch name could cause conflicts if multiple PRs need to be created simultaneously. Consider including a timestamp or unique identifier.

 env:
-  BRANCH_NAME: chore/gh-update-destinations-ts
+  BRANCH_NAME: chore/gh-update-destinations-ts-${{ github.run_id }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba6d5c and 9847825.

⛔ Files ignored due to path filters (6)
  • generated/Destinations.dart is excluded by !**/generated/**
  • generated/Destinations.java is excluded by !**/generated/**
  • generated/Destinations.kt is excluded by !**/generated/**
  • generated/Destinations.m is excluded by !**/generated/**
  • generated/Destinations.swift is excluded by !**/generated/**
  • generated/Destinations.ts is excluded by !**/generated/**
📒 Files selected for processing (8)
  • .github/workflows/check-generated.yml (1 hunks)
  • .github/workflows/raise-pr-for-constants.yml (1 hunks)
  • templates/Destinations.dart.template (1 hunks)
  • templates/Destinations.java.template (1 hunks)
  • templates/Destinations.kt.template (1 hunks)
  • templates/Destinations.m.template (1 hunks)
  • templates/Destinations.swift.template (1 hunks)
  • templates/Destinations.ts.template (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • templates/Destinations.m.template
🚧 Files skipped from review as they are similar to previous changes (6)
  • templates/Destinations.ts.template
  • templates/Destinations.java.template
  • .github/workflows/check-generated.yml
  • templates/Destinations.swift.template
  • templates/Destinations.dart.template
  • templates/Destinations.kt.template
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/raise-pr-for-constants.yml

39-39: shellcheck reported issue in this script: SC2034:warning:2:1: DEST_REPO appears unused. Verify use (or export if used externally)

(shellcheck)


39-39: shellcheck reported issue in this script: SC2086:info:7:31: Double quote to prevent globbing and word splitting

(shellcheck)


39-39: shellcheck reported issue in this script: SC2086:info:10:30: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 yamllint (1.35.1)
.github/workflows/raise-pr-for-constants.yml

[error] 36-36: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
.github/workflows/raise-pr-for-constants.yml (1)

1-11: LGTM! Well-configured workflow triggers and permissions.

The workflow is correctly configured to trigger on pushes to the develop branch, and the required permissions are explicitly declared following security best practices.

.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
vinayteki95
vinayteki95 previously approved these changes Dec 10, 2024
Copy link
Contributor

@vinayteki95 vinayteki95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All coderabbit suggestions are relevant and should be considered to make changes.
Work flow looks good.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/raise-pr-for-constants.yml (1)

56-61: Enhance commit operation with better error handling and message.

The commit operation needs better error handling and a more descriptive commit message.

 cd dest-repo
-cp "../generated/Destinations.ts" "packages/analytics-js-common/src/constants/integrations/Destinations.ts"
+cp "../${{ env.SRC_FILE }}" "${{ env.DEST_PATH }}" || {
+  echo "Error: Failed to copy file"
+  exit 1
+}
 git add packages/analytics-js-common/src/constants/integrations/Destinations.ts
-git commit -m "chore: update destinations.ts"
+git commit -m "chore: update destination constants
+
+Update Destinations.ts with latest constants from source repository"
 git push origin ${{ env.BRANCH_NAME }}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9847825 and c82ef88.

📒 Files selected for processing (1)
  • .github/workflows/raise-pr-for-constants.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/raise-pr-for-constants.yml

41-41: shellcheck reported issue in this script: SC2086:info:3:31: Double quote to prevent globbing and word splitting

(shellcheck)


41-41: shellcheck reported issue in this script: SC2086:info:6:30: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (4)
.github/workflows/raise-pr-for-constants.yml (4)

1-11: LGTM! Well-structured workflow configuration.

The workflow configuration follows best practices with:

  • Clear workflow name
  • Appropriate trigger on develop branch
  • Explicit permissions declaration

12-16: LGTM! Well-defined environment variables.

Environment variables are appropriately defined at the workflow level with clear naming conventions.


69-71: 🛠️ Refactor suggestion

Enhance PR creation with better title and description.

The current PR creation is too basic. Consider adding a more descriptive title and body.

-gh pr create -f
+gh pr create \
+  --title "chore: update destination constants [automated]" \
+  --body "## Description
+
+This PR updates the destination constants file with the latest changes.
+
+## Changes
+- Updated \`Destinations.ts\` with latest constants from source repository
+
+This PR was automatically generated by GitHub Actions." \
+  --label "automated"

Likely invalid or redundant comment.


31-31: 🛠️ Refactor suggestion

Enhance security of git clone operation.

Consider using the actions/checkout action instead of direct git clone for better security and maintainability.

-git clone https://github.com/${DEST_REPO}.git dest-repo || exit 1
+uses: actions/checkout@v4
+with:
+  repository: ${DEST_REPO}
+  path: dest-repo
+  token: ${{ secrets.GITHUB_TOKEN }}

Likely invalid or redundant comment.

.github/workflows/raise-pr-for-constants.yml Outdated Show resolved Hide resolved
@koladilip koladilip force-pushed the chore/add-pr-raiser-workflow branch from c82ef88 to c9f47b8 Compare December 10, 2024 04:24
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
.github/workflows/raise-pr-for-constants.yml (2)

56-61: Improve file operations and commit message

Consider these improvements:

  1. Use environment variables consistently
  2. Add more descriptive commit message
-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 "chore: update destinations.ts"
+cp "../${SRC_FILE}" "${DEST_PATH}"
+git add "${DEST_PATH}"
+git commit -m "chore: update destination constants [automated]
+
+This commit updates the destination constants file with the latest changes from the source repository."

70-78: Enhance PR creation with better metadata

Consider these improvements:

  1. Remove trailing spaces
  2. Add more context to PR description
  3. Add additional useful labels
 gh pr create \
   --title "chore: 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"
+  --label "automated,dependencies,no-changelog-needed" \
+  --assignee "@me"
🧰 Tools
🪛 yamllint (1.35.1)

[error] 76-76: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c82ef88 and c9f47b8.

📒 Files selected for processing (1)
  • .github/workflows/raise-pr-for-constants.yml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/raise-pr-for-constants.yml

41-41: shellcheck reported issue in this script: SC2086:info:3:31: Double quote to prevent globbing and word splitting

(shellcheck)


41-41: shellcheck reported issue in this script: SC2086:info:6:30: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 yamllint (1.35.1)
.github/workflows/raise-pr-for-constants.yml

[error] 76-76: trailing spaces

(trailing-spaces)

🔇 Additional comments (4)
.github/workflows/raise-pr-for-constants.yml (4)

1-11: LGTM! Well-configured workflow trigger and permissions

The workflow trigger and permissions are properly configured:

  • Triggers on push to develop branch
  • Explicit permissions for contents and pull-requests write access

12-16: LGTM! Well-structured environment variables

Good practice using environment variables for reusable values. The paths and branch naming are well-structured.


31-31: ⚠️ Potential issue

Security: Avoid exposing credentials in git clone URL

Replace the current git clone command with a more secure approach:

-git clone https://github.com/${DEST_REPO}.git dest-repo || exit 1
+git clone https://github.com/${DEST_REPO}.git dest-repo
+cd dest-repo
+git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"

42-48: 🛠️ Refactor suggestion

Add proper quoting and error handling to file comparison

Add proper quoting to prevent issues with special characters:

-if cmp -s "${{ env.SRC_FILE }}" "dest-repo/${{ env.DEST_PATH }}"; then
+if cmp -s "${SRC_FILE}" "dest-repo/${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

@koladilip koladilip force-pushed the chore/add-pr-raiser-workflow branch from c9f47b8 to 993b522 Compare December 10, 2024 04:27
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (2)
.github/workflows/raise-pr-for-constants.yml (2)

69-77: Enhance PR creation with better metadata and error handling

The PR creation needs improvements:

  1. More descriptive title and body
  2. Better error handling for file operations
  3. More specific labels
-            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"
+            {
+              echo "Changes in destination constants:"
+              diff -u "dest-repo/${{ env.DEST_PATH }}" "${{ env.SRC_FILE }}" || true
+            } > pr_diff.txt
+            
+            gh pr create \
+              --title "fix: update destination constants [$(date +%Y-%m-%d)]" \
+              --body "This PR updates the destination constants with the latest changes.
+
+              **Changes:**
+              - Updated \`Destinations.ts\` with latest constants from \`develop\` branch
+              
+              <details>
+              <summary>Detailed Changes</summary>
+              
+              \`\`\`diff
+              $(cat pr_diff.txt)
+              \`\`\`
+              </details>
+              
+              This PR was automatically generated by GitHub Actions.
+              
+              Related to: #${GITHUB_EVENT_NUMBER:-N/A}" \
+              --label "automated,dependencies,constants-update"
🧰 Tools
🪛 yamllint (1.35.1)

[error] 75-75: trailing spaces

(trailing-spaces)


75-75: Remove trailing whitespace

There is trailing whitespace on this line that should be removed.

-              
+
🧰 Tools
🪛 yamllint (1.35.1)

[error] 75-75: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c9f47b8 and a5331ee.

📒 Files selected for processing (2)
  • .github/workflows/check-generated.yml (1 hunks)
  • .github/workflows/raise-pr-for-constants.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/check-generated.yml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/raise-pr-for-constants.yml

40-40: shellcheck reported issue in this script: SC2086:info:3:31: Double quote to prevent globbing and word splitting

(shellcheck)


40-40: shellcheck reported issue in this script: SC2086:info:6:30: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 yamllint (1.35.1)
.github/workflows/raise-pr-for-constants.yml

[error] 75-75: trailing spaces

(trailing-spaces)

🔇 Additional comments (1)
.github/workflows/raise-pr-for-constants.yml (1)

31-35: ⚠️ Potential issue

Enhance security and Git configuration

The Git clone and configuration steps need security improvements:

  1. Use HTTPS URL without embedding token
  2. Add error handling for Git operations
  3. Set Git configuration before clone
-          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 "[email protected]"
-          git config --global url."https://${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
+          git config --global user.name "GitHub Actions"
+          git config --global user.email "[email protected]"
+          git clone https://github.com/${DEST_REPO}.git dest-repo || {
+            echo "Failed to clone repository"
+            exit 1
+          }
+          cd dest-repo || exit 1
+          git remote set-url origin "https://${{ secrets.GITHUB_TOKEN }}@github.com/${DEST_REPO}.git"

Likely invalid or redundant comment.

.github/workflows/raise-pr-for-constants.yml Show resolved Hide resolved
.github/workflows/raise-pr-for-constants.yml Show resolved Hide resolved
@koladilip koladilip merged commit 56831b3 into develop Dec 10, 2024
14 checks passed
@koladilip koladilip deleted the chore/add-pr-raiser-workflow branch December 10, 2024 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants