From 361e5530c5d7bd30c7f721e74e5d7d6e54ac9f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Saparelli?= Date: Thu, 16 Jun 2022 11:34:58 +0000 Subject: [PATCH] Fix EOF error in release PR action (#319) --- .github/workflows/release-pr.yml | 26 +++++++++++--------------- .github/workflows/release-tag.yml | 14 +++----------- 2 files changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index a236742..f202a17 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -82,27 +82,23 @@ jobs: - name: Create PR run: | set -euxo pipefail + + nl=$'\n' + br=$'\n\n' + fence='```\n' + ecnef='\n```' + title="release: ${{ inputs.crate }} v${{ inputs.version }}" - body="This is a release PR for **${{ inputs.crate }}** to version **${{ inputs.version }}**." + body_intro="This is a release PR for **${{ inputs.crate }}** to version **${{ inputs.version }}**." if [[ "${{ inputs.crate }}" == "cli" ]]; then - body="$body - - Upon merging, this will automatically build the CLI and create a GitHub release. You still need to manually publish the cargo crate." + body_merge="Upon merging, this will automatically build the CLI and create a GitHub release. You still need to manually publish the cargo crate." else - body="$body - - Upon merging, you will still need to manually publish the cargo crate." + body_merge="Upon merging, you will still need to manually publish the cargo crate." fi - body="$body - \`\`\` - $ cd crates/${{ env.crate_path }} - $ cargo publish - \`\`\` + body_outro="${fence}$ cd crates/${{ env.crate_path }}${nl}$ cargo publish${ecnef}${br}To merge this release, review the changes then say:${br}\`bors r+ p=10\`" - To merge this release, review the changes then say: - - `bors r+ p=10` + body="${body_intro}${br}${body_merge}${br}${body_outro}" gh pr create --title "$title" --body "$body" --base main --head "${{ env.branch_name }}" --label "release" env: diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index b7bcb87..d23acf9 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -15,20 +15,12 @@ jobs: if: "startsWith(github.event.head_commit.message, 'release: ')" steps: - name: Extract tag from commit message + env: + COMMIT_MESSAGE: ${{ github.event.head_commit.message }} run: | set -euxo pipefail - read -r -d '' message <<'COMMITMESSAGESEPARATOR' - ${{ github.event.head_commit.message }} - COMMITMESSAGESEPARATOR - - # trim both ends - message="${message#"${message%%[![:space:]]*}"}" - message="${message%"${message##*[![:space:]]}"}" - - # get first line - message="$(head -n1 <<< "$message")" - + message="$(head -n1 <<< "$COMMIT_MESSAGE")" crate="$(cut -d ' ' -f 2 <<< "${message}")" version="$(cut -d ' ' -f 3 <<< "${message}")" echo "CUSTOM_TAG=${crate}-${version}" >> $GITHUB_ENV