From 476368dcd68250de82ead1d57af3e58a2e8644bf Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Fri, 9 Jun 2023 13:21:38 +0800 Subject: [PATCH] workflows: improve style --- .github/workflows/create-replacement-pr.yml | 2 +- .github/workflows/publish-commit-bottles.yml | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create-replacement-pr.yml b/.github/workflows/create-replacement-pr.yml index b793df960bea3..d28e47dc423a2 100644 --- a/.github/workflows/create-replacement-pr.yml +++ b/.github/workflows/create-replacement-pr.yml @@ -81,7 +81,7 @@ jobs: gh api \ --header 'Accept: application/vnd.github+json' \ --header 'X-GitHub-Api-Version: 2022-11-28' \ - "repos/$GH_REPO/pulls/$PR/reviews" + "repos/{owner}/{repo}/pulls/$PR/reviews" )" reviewers="$(jq --compact-output '[.[].user.login]' <<< "$review_data")" diff --git a/.github/workflows/publish-commit-bottles.yml b/.github/workflows/publish-commit-bottles.yml index b555045760ff0..27aa655cb1206 100644 --- a/.github/workflows/publish-commit-bottles.yml +++ b/.github/workflows/publish-commit-bottles.yml @@ -33,7 +33,7 @@ on: env: PR: ${{inputs.pull_request}} - AUTOSQUASH: ${{ inputs.autosquash }} + INPUT_MESSAGE: ${{ inputs.message }} GNUPGHOME: /tmp/gnupghome HOMEBREW_DEVELOPER: 1 HOMEBREW_NO_AUTO_UPDATE: 1 @@ -42,10 +42,10 @@ env: GH_NO_UPDATE_NOTIFIER: 1 GH_PROMPT_DISABLED: 1 RUN_URL: ${{github.event.repository.html_url}}/actions/runs/${{github.run_id}} - NON_PUSHABLE_MESSAGE: > + NON_PUSHABLE_MESSAGE: >- :no_entry: It looks like @BrewTestBot cannot push to your PR branch. For future pull requests, please [allow maintainers to edit your PR](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to simplify the merge process. - ORG_FORK_MESSAGE: > + ORG_FORK_MESSAGE: >- :no_entry: It looks like @BrewTestBot cannot push to your PR branch. Please open future pull requests from a non-organization fork to simplify the merge process. @@ -160,7 +160,7 @@ jobs: echo "remote_branch=$remote_branch" echo "remote=$remote" echo "node_id=$node_id" - echo "replace=$AUTOSQUASH" + echo "replace=${{ inputs.autosquash }}" } >> "$GITHUB_OUTPUT" if "$pushable" && [[ "$fork_type" != "Organization" ]] || @@ -185,15 +185,14 @@ jobs: fromJson(steps.pr-branch-check.outputs.bottles) env: GH_TOKEN: ${{secrets.GITHUB_TOKEN}} - MESSAGE: ${{ inputs.message }} run: | gh workflow run create-replacement-pr.yml \ --ref "$GITHUB_REF_NAME" \ --field pull_request="$PR" \ - --field autosquash="$AUTOSQUASH" \ + --field autosquash='${{ inputs.autosquash }}' \ --field upload='${{ !inputs.autosquash }}' \ --field warn_on_upload_failure=false \ - --field message="$MESSAGE" + --field message="$INPUT_MESSAGE" - name: Post comment on failure if: ${{!success()}} @@ -282,7 +281,6 @@ jobs: HOMEBREW_GITHUB_PACKAGES_USER: brewtestbot HOMEBREW_GITHUB_PACKAGES_TOKEN: ${{secrets.HOMEBREW_CORE_GITHUB_PACKAGES_TOKEN}} EXPECTED_SHA: ${{needs.check.outputs.head_sha}} - MESSAGE: ${{inputs.message}} run: | local_git_head="$(git rev-parse HEAD)" remote_git_head="$(git ls-remote origin "pull/$PR/head" | cut -f1)" @@ -306,7 +304,7 @@ jobs: --committer="$BREWTESTBOT_NAME_EMAIL" \ --root-url="https://ghcr.io/v2/homebrew/core" \ ${{inputs.warn_on_upload_failure && '--warn-on-upload-failure' || ''}} \ - ${{inputs.message && '--message="$MESSAGE"' || ''}} \ + ${{inputs.message && '--message="$INPUT_MESSAGE"' || ''}} \ "$PR" echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"