Skip to content

Commit

Permalink
Add "ready-to-test" labels to all automated backports
Browse files Browse the repository at this point in the history
This PR adds logic that will add "ready-to-test" label to all automated
backports. The label is added separately after PR is created so that PR
creation does not fail if the label is missing in the repository.

Signed-off-by: Janki Chhatbar <[email protected]>
  • Loading branch information
Jaanki authored and skitt committed Dec 6, 2022
1 parent a1c9bdb commit a60f986
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/shared/backport.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,14 @@ For details on the backport process, see the [backport requests](https://submari
EOF
)

gh pr create --title="Automated backport of ${numandtitle}" --body="${prtext}" --head "${GITHUB_USER}:${NEWBRANCH}" --base "${rel}" --repo="${MAIN_REPO_ORG}/${MAIN_REPO_NAME}" --label automated-backport
local created_pr pr_url
created_pr=$(gh pr create --title="Automated backport of ${numandtitle}" --body="${prtext}" --head "${GITHUB_USER}:${NEWBRANCH}" --base "${rel}" --repo="${MAIN_REPO_ORG}/${MAIN_REPO_NAME}" --label automated-backport)

# Add "ready-to-test" label separately so that PR creation does not fail in case of missing label.
pr_url=$(echo "${created_pr}" | awk -F'^http[s]?://' '{print $2}')
gh pr edit "${pr_url}" --add-label "ready-to-test" || echo "Failed adding 'ready-to-test' label, skipping it"

# Add "backport-handled" label to the original PR
for pull in "${PULLS[@]}"; do
echo "+++ Adding 'backport-handled' label to"
gh pr edit "$pull" --repo="${MAIN_REPO_ORG}/${MAIN_REPO_NAME}" --add-label "backport-handled"
Expand Down

0 comments on commit a60f986

Please sign in to comment.