Skip to content

Commit 37e1a45

Browse files
committed
Include info in the PR body related with workflow inputs
1 parent cec4831 commit 37e1a45

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/release-proposal-dispatch.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,14 @@ jobs:
363363
364364
# if there is a tag more recent than $TAG, continue the loop
365365
LATEST_TAG=$(git tag -l "$TAG_PREFIX*" --sort=-v:refname | head -1)
366-
if [ "$LATEST_TAG" != "$TAG" ] && [ "${{ inputs.bypass_standard_checks }}" = "false" ]; then
366+
if [ "$LATEST_TAG" != "$TAG" ]; then
367367
echo "Tag $TAG is not the latest. Latest is: $LATEST_TAG. main branch has the latest release for $NAME"
368-
echo "Skipping release for $NAME"
369-
continue
368+
if [ "${{ inputs.bypass_standard_checks }}" = "false" ]; then
369+
echo "Skipping release for $NAME"
370+
continue
371+
else
372+
echo "Continuing with the release for $NAME because bypass_standard_checks is true"
373+
fi
370374
fi
371375
372376
echo "Executing semver-level.sh for $NAME since $RANGE (tag: $TAG)..."
@@ -532,9 +536,22 @@ jobs:
532536
- name: Create a PR
533537
env:
534538
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
539+
MAIN_START_REF: ${{ inputs.main_start_ref }}
540+
MAIN_BRANCH: ${{ env.MAIN_BRANCH }}
541+
BYPASS_STANDARD_CHECKS: ${{ inputs.bypass_standard_checks }}
542+
PROPOSAL_BRANCH_PREFIX: ${{ env.PROPOSAL_BRANCH_PREFIX }}
543+
RELEASE_BRANCH_PREFIX: ${{ env.RELEASE_BRANCH_PREFIX }}
535544
run: |
536545
BRANCH_NAME="${{ needs.cargo-release.outputs.branch_name }}"
537-
546+
547+
NON_DEFAULT=""
548+
if [ -n "$MAIN_START_REF" ]; then
549+
NON_DEFAULT+=$(printf '### Cut from non-default ref\n\nThis proposal was generated from `%s` instead of the default latest `origin/%s`.\n\n' "$MAIN_START_REF" "$MAIN_BRANCH")
550+
fi
551+
if [ "$BYPASS_STANDARD_CHECKS" = "true" ]; then
552+
NON_DEFAULT+=$(printf '### Non-default workflow options\n\n**bypass_standard_checks** was enabled: the ongoing-proposal branch guard was skipped; branches use proposal prefix `%s` and release prefix `%s`. Crates whose resolved git tag is not the latest SemVer tag for that crate are still included (normally skipped).\n\n' "$PROPOSAL_BRANCH_PREFIX" "$RELEASE_BRANCH_PREFIX")
553+
fi
554+
538555
# Generate the PR body by merging commits and API changes
539556
# Note: read returns 1 when it reaches EOF, which is expected for heredocs
540557
read -r -d '' JQ_FILTER << 'EOF' || true
@@ -556,13 +573,13 @@ jobs:
556573
] | map(select(. != null and . != "")) | join("\n")
557574
EOF
558575
559-
PR_BODY=$(jq -r --slurpfile api /tmp/api-changes.json "$JQ_FILTER" /tmp/commits-by-crate.json)
560-
576+
COMMITS_AND_API_BODY=$(jq -r --slurpfile api /tmp/api-changes.json "$JQ_FILTER" /tmp/commits-by-crate.json)
577+
561578
PR_BODY="# Release proposal for ${{ inputs.crate }} and its dependencies
562579
563580
This PR contains version bumps based on public API changes and commits since last release.
564581
565-
${PR_BODY}"
582+
${NON_DEFAULT}${COMMITS_AND_API_BODY}"
566583
567584
echo "$PR_BODY" > /tmp/pr-body.md
568585
echo "PR body written to /tmp/pr-body.md (length: $(wc -c < /tmp/pr-body.md) bytes)"

0 commit comments

Comments
 (0)