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

fix: glue sync job main fetch #34

Merged
merged 1 commit into from
Nov 19, 2024
Merged
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
7 changes: 3 additions & 4 deletions .github/workflows/scripts/sync-glue-jobs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,18 @@ PR_BODY="## Summary
Automated sync of AWS Glue ETL jobs."

# Check if the remote branch exists
git fetch "$REMOTE_REPO"
git fetch "$REMOTE_REPO" "$BASE_BRANCH":"$BASE_BRANCH"
if git ls-remote --heads "$REMOTE_REPO" "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
CREATE_PR="false"
echo "Branch '$BRANCH_NAME' exists. Checking out and updating."
git stash
git checkout "$BRANCH_NAME"
git stash pop
CREATE_PR="false"
else
echo "Branch '$BRANCH_NAME' does not exist. Creating new branch."
git checkout -b "$BRANCH_NAME" "$BASE_BRANCH"
fi

# Check for changes in the repository
# Check for changes in the branch
if git diff-index --quiet HEAD -- "$JOB_DIR"; then
echo "No changes detected."
exit 0
Expand All @@ -52,6 +50,7 @@ for FILE in $FILES_CHANGED; do
--field sha="$SHA"
done

# Create the PR if it doesn't already exist
if [ "$CREATE_PR" = "true" ]; then
echo "Creating PR..."
gh pr create --base "$BASE_BRANCH" --head "$BRANCH_NAME" --title "$PR_TITLE" --body "$PR_BODY"
Expand Down
Loading