-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Reverse sync workflow #6
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
Conversation
WalkthroughThe reverse-sync-push GitHub Actions workflow was updated to include extensive debug and informational logging at each major step. These additions provide detailed output for PR data retrieval, patch generation, git status, staged changes, and commit message construction, improving transparency into the workflow's execution process without modifying its core logic. Changes
Possibly related PRs
Suggested reviewers
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (3)
.github/workflows/reverse-sync-push.yml (3)
87-96: Limit raw-JSON logging to avoid log bloat & accidental PII exposureDumping the complete PR payload into the workflow log (
echo "👀 PR data $pr_info ...") can:
- Produce multi-hundred-line noise for every run, hampering log readability.
- Surface fields that are not required for the sync (e.g. author bio, labels, review data), or that may contain PII.
Consider gating this behind a debug flag or trimming the output:
-echo "👀 PR data $pr_info ..." +if [[ "${{ github.event.inputs.debug || '' }}" == "true" ]]; then + echo "👀 Full PR JSON:" + echo "$pr_info" | jq . +else + # Keep a concise, single-line summary + echo "👀 PR fetched (id=$pr_number, title=\"${pr_title}\")" +fiThis keeps day-to-day logs concise while still allowing deep inspection when explicitly requested.
178-180:cat changes.patchmay leak large diffs & internal detailsPiping the entire patch into the public log could unintentionally expose proprietary documentation or overwhelm the job logs (> 10 MB caps). Recommend one of:
- Log only the file list (
git patch-idorgit apply --stat),- Compress/attach the patch as an artifact (
actions/upload-artifact),- Or gate the verbose dump behind a
DEBUGflag similar to the previous comment.This keeps logs lean and prevents inadvertent disclosure.
217-231: Use machine-friendly status and group logs for readability
git statuswithout flags emits color codes and human prose that are noisy in CI. Prefer:-git status +git status --short --branchAdditionally, collapsible log groups make the CI view easier to skim:
echo "::group::git-status" git status --short --branch echo "::endgroup::"Same applies to the surrounding “Adding changes…” echoes.
| echo "=> Creating commit message..." | ||
| echo " - PR Number: $pr_number" | ||
| echo " - PR Title: $pr_title" | ||
| echo " - PR Author: $pr_author" | ||
| echo " - PR URL: $pr_url" | ||
| echo " - Commit SHA: $commit_sha" | ||
| # Create commit message with reverse sync marker | ||
| cat > commit_message.txt << EOF | ||
| [reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number | ||
| This commit incorporates changes from external contributors to the devops-pipelines-docs repository. | ||
| echo "[reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number" > commit_message.txt | ||
| echo "" >> commit_message.txt | ||
| echo "- Title: $pr_title" >> commit_message.txt | ||
| echo "- Author: $pr_author" >> commit_message.txt | ||
| echo "- URL: $pr_url" >> commit_message.txt | ||
| echo "- Commit: $commit_sha" >> commit_message.txt | ||
| 📋 Original PR Details: | ||
| - Title: $pr_title | ||
| - Author: $pr_author | ||
| - URL: $pr_url | ||
| - Commit: $commit_sha | ||
| echo "=> Commit message:" | ||
| cat commit_message.txt | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Robust commit-message construction
Building the message line-by-line via echo can break if any field contains
newlines or leading - characters (common in markdown titles). A safer
heredoc keeps formatting intact:
-echo "[reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number" > commit_message.txt
-echo "" >> commit_message.txt
-echo "- Title: $pr_title" >> commit_message.txt
-echo "- Author: $pr_author" >> commit_message.txt
-echo "- URL: $pr_url" >> commit_message.txt
-echo "- Commit: $commit_sha" >> commit_message.txt
+cat > commit_message.txt <<EOF
+[reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number
+
+- Title: $pr_title
+- Author: $pr_author
+- URL: $pr_url
+- Commit: $commit_sha
+EOFThis avoids quoting issues and is easier to maintain.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| echo "=> Creating commit message..." | |
| echo " - PR Number: $pr_number" | |
| echo " - PR Title: $pr_title" | |
| echo " - PR Author: $pr_author" | |
| echo " - PR URL: $pr_url" | |
| echo " - Commit SHA: $commit_sha" | |
| # Create commit message with reverse sync marker | |
| cat > commit_message.txt << EOF | |
| [reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number | |
| This commit incorporates changes from external contributors to the devops-pipelines-docs repository. | |
| echo "[reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number" > commit_message.txt | |
| echo "" >> commit_message.txt | |
| echo "- Title: $pr_title" >> commit_message.txt | |
| echo "- Author: $pr_author" >> commit_message.txt | |
| echo "- URL: $pr_url" >> commit_message.txt | |
| echo "- Commit: $commit_sha" >> commit_message.txt | |
| 📋 Original PR Details: | |
| - Title: $pr_title | |
| - Author: $pr_author | |
| - URL: $pr_url | |
| - Commit: $commit_sha | |
| echo "=> Commit message:" | |
| cat commit_message.txt | |
| echo "=> Creating commit message..." | |
| echo " - PR Number: $pr_number" | |
| echo " - PR Title: $pr_title" | |
| echo " - PR Author: $pr_author" | |
| echo " - PR URL: $pr_url" | |
| echo " - Commit SHA: $commit_sha" | |
| # Create commit message with reverse sync marker | |
| cat > commit_message.txt <<EOF | |
| [reverse-sync] Sync documentation changes from devops-pipelines-docs PR #$pr_number | |
| - Title: $pr_title | |
| - Author: $pr_author | |
| - URL: $pr_url | |
| - Commit: $commit_sha | |
| EOF | |
| echo "=> Commit message:" | |
| cat commit_message.txt |
🤖 Prompt for AI Agents
In .github/workflows/reverse-sync-push.yml around lines 239 to 257, the commit
message is constructed line-by-line using echo, which can cause issues if any
variables contain newlines or leading dashes. Replace the multiple echo
statements with a single heredoc block to build the commit message, preserving
formatting and avoiding quoting problems. Use the heredoc syntax to include all
variables directly, ensuring the message is robust and easier to maintain.
Summary by CodeRabbit