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

NO-ISSUE: fix sync main capture uncommitted changes step #52

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ This pull request has been created by a GitHub workflow to synchronize the main

<details>
<summary>Resolved conflicts:</summary>
$SYNC_CHANGES
$TRUNCATED_SYNC_CHANGES
</details>
15 changes: 12 additions & 3 deletions .github/workflows/osl_sync_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
run: |
SYNC_CHANGES=$(git status --porcelain)
echo "$SYNC_CHANGES" > /tmp/sync_changes.txt
if [ -s /tmp/sync_changes.txt ]; then
if [ -n "$SYNC_CHANGES" ]; then
echo "HAS_CHANGES=true" >> $GITHUB_ENV
else
echo "HAS_CHANGES=false" >> $GITHUB_ENV
Expand All @@ -117,10 +117,19 @@ jobs:
run: |
set -x
SYNC_CHANGES=$(cat /tmp/sync_changes.txt)
ESCAPED_CHANGES=$(echo "$SYNC_CHANGES" | sed -e ':a' -e 'N' -e '$!ba' -e 's|\n|\\n|g' -e 's|/|\\/|g')

# Truncate SYNC_CHANGES to 5000
MAX_CHARS=5000
if [ ${#SYNC_CHANGES} -gt $MAX_CHARS ]; then
TRUNCATED_SYNC_CHANGES="${SYNC_CHANGES:0:$MAX_CHARS}..."
else
TRUNCATED_SYNC_CHANGES="$SYNC_CHANGES"
fi

ESCAPED_CHANGES=$(echo "$TRUNCATED_SYNC_CHANGES" | sed -e ':a' -e 'N' -e '$!ba' -e 's|\n|\\n|g' -e 's|/|\\/|g')

# Use double quotes for variable substitution in sed
sed -e "s|\\\$RUN_URL|${RUN_URL}|g" -e "s|\\\$SYNC_CHANGES|${ESCAPED_CHANGES}|g" .github/supporting-files/ci/templates/osl_sync_pr_template.md > temp.md
sed -e "s|\\\$RUN_URL|${RUN_URL}|g" -e "s|\\\$TRUNCATED_SYNC_CHANGES|${ESCAPED_CHANGES}|g" .github/supporting-files/ci/templates/osl_sync_pr_template.md > temp.md

prTitle="[$(date +'%Y-%m-%d:%H%M%S')] - :robot: Automated PR: Sync main with upstream"
reviewersOption=""
Expand Down
Loading