Skip to content

Commit

Permalink
propose change for the workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ntluong95 committed Jun 15, 2024
1 parent f25d309 commit 729fb88
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/create_pr_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,20 @@ jobs:
fi
git push origin "${TRANSLATION_BRANCH}"
# Check if a PR already exists for this branch
PR_EXISTS=$(gh pr list --head "${TRANSLATION_BRANCH}" --state open --json number --jq length)
if [ "$PR_EXISTS" -eq 0 ]; then
PR_URL=$(gh pr create --base main --head "$TRANSLATION_BRANCH" --title "Handbook ${VERSION_SUFFIX/_en/} $lang" --body "Automated pull request for $lang handbook version ${VERSION_SUFFIX/_en/}")
PR_NUMBER=$(echo "$PR_URL" | grep -oE '[0-9]+$')
else
# Get the PR number for the translation branch
PR_NUMBER=$(gh pr list --base main --json number --jq ".[] | select(.headRefName == \"$TRANSLATION_BRANCH\") | .number")
PR_NUMBER=$(gh pr list --base main --json number --jq ".[] | select(.headRefName == \"$TRANSLATION_BRANCH\") | .number")
fi
echo "Pull Request Number: $PR_NUMBER"
# Get the date of the latest commit on the translation branch
latest_commit_date=$(git show -s --format=%ci ${TRANSLATION_BRANCH})
Expand Down

0 comments on commit 729fb88

Please sign in to comment.