Skip to content

Commit

Permalink
propose changes to review
Browse files Browse the repository at this point in the history
  • Loading branch information
ntluong95 authored Jun 15, 2024
1 parent f25d309 commit 176b12a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/create_pr_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,18 @@ jobs:
fi
git push origin "${TRANSLATION_BRANCH}"
# Get the PR number for the translation branch
PR_NUMBER=$(gh pr list --base main --json number --jq ".[] | select(.headRefName == \"$TRANSLATION_BRANCH\") | .number")
# 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")
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 All @@ -65,4 +75,4 @@ jobs:
gh api repos/${{ github.repository }}/issues/$PR_NUMBER --method PATCH --field body="$checkboxes"
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 176b12a

Please sign in to comment.