From ec4a8a8be16ed5181b0b7dc5a621d1960fea59f5 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 24 Jul 2021 02:58:25 -0700 Subject: [PATCH] Use a variable to define error message prefix Whenever the bot needs to communicate to the user about a blocking issue with their pull request that they are able to resolve, a standardized prefix is added to the situation-specific error message (":x: **ERROR:**") to draw their attention to this information. This standardized text occurred multiple times in the workflow, which might lead to it becoming inconsistent over time, or just more work to improve the text. Use of an environment variable ensures that all uses of the prefix will be consistent and allows it to be edited once in a single place. --- .github/workflows/manage-prs.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manage-prs.yml b/.github/workflows/manage-prs.yml index efa8f5ab..2f6dcaeb 100644 --- a/.github/workflows/manage-prs.yml +++ b/.github/workflows/manage-prs.yml @@ -6,6 +6,7 @@ env: # GitHub user names to request reviews from in cases where PRs can't be managed automatically. - per1234 CHECK_SUBMISSIONS_FAIL_FLAG_ARTIFACT: check-submissions-failed + ERROR_MESSAGE_PREFIX: ":x: **ERROR:** " on: # pull_request_target trigger is used instead of pull_request so the token will have the write permissions needed to @@ -205,7 +206,7 @@ jobs: | A problem was found with your submission ${{ matrix.submission.submissionURL }} - :x: **ERROR:** ${{ matrix.submission.error }} + ${{ env.ERROR_MESSAGE_PREFIX }}${{ matrix.submission.error }} - name: Set checks result to fail if error detected by submission parser if: matrix.submission.error != '' @@ -296,7 +297,7 @@ jobs: issue_number: ${{ github.event.pull_request.number }}${{ github.event.issue.number }} body: | | - :x: **ERROR:** [Arduino Lint](https://github.com/arduino/arduino-lint) found errors with ${{ matrix.submission.submissionURL }}: + ${{ env.ERROR_MESSAGE_PREFIX }}[Arduino Lint](https://github.com/arduino/arduino-lint) found errors with ${{ matrix.submission.submissionURL }}: ``` ${{ steps.read-lint-report.outputs.text-report }} @@ -462,7 +463,7 @@ jobs: issue_number: ${{ github.event.pull_request.number }}${{ github.event.issue.number }} body: | | - :x: **ERROR:** Your submission meets all requirements. However, the pull request could not be merged. + ${{ env.ERROR_MESSAGE_PREFIX }}Your submission meets all requirements. However, the pull request could not be merged. Please follow this guide to resolve a merge conflict: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github