You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Got problem when trying to manual retry the workflow after having some issue in previous build
Prepared hack for it to update env variable based on found open pull request in github using gh
# Parse variables from env
REPO_OWNER=$(echo $CM_REPO_SLUG | cut -d'/' -f1)
REPO_NAME=$(echo $CM_REPO_SLUG | cut -d'/' -f2)
BRANCH_NAME="$CM_BRANCH"
# Auth to github using PAT
echo $GITHUB_PAT | gh auth login --with-token
# Use GitHub CLI to get the list of pull requests for the specified branch
# The '--jq' flag is used to parse the JSON response directly within the GitHub CLI
PR_ID=$(gh pr list --repo $REPO_OWNER/$REPO_NAME --head "$BRANCH_NAME" --state open --json number --jq '.[0].number')
if [ "$PR_ID" != "null" ]; then
echo "Pull Request ID for branch '$BRANCH_NAME' is $PR_ID"
# Set the pull request ID as an environment variable
echo "CM_PULL_REQUEST_NUMBER=$PR_ID" >> $CM_ENV
else
echo "No open pull request found for branch '$BRANCH_NAME'"
exit 0
fi
With using it we solving problem with not idempotent behavior
The text was updated successfully, but these errors were encountered:
Nice, thanks for the tip! This is something I could integrate into the CLI itself. As it is today, I can check if CM_PULL_REQUEST_NUMBER is empty and if yes, also check with gh CLI and only if this also empty then throw an exception that no pull request could be found.
Got problem when trying to manual retry the workflow after having some issue in previous build
Prepared hack for it to update env variable based on found open pull request in github using
gh
With using it we solving problem with not idempotent behavior
The text was updated successfully, but these errors were encountered: