You've already forked library-registry
mirror of
https://github.com/arduino/library-registry.git
synced 2025-07-09 01:42:00 +03:00
Handle general problems with pull request
When possible, if problems are detected in a pull request, the bot will attempt to guide the PR author through the process of making a valid submission, which should be handled in a completely automated fashion on our end. It has become clear that we need to prevent the removal of the final newline from `repositories.txt`. The existing system did not accomodate this requirement. Submissions are validated on a per-library basis, and the bot comments based on identifying which library the problem applies to. But this newline removal is not necessarily related to any specific item added to the list. So handling for general problems with a submission PR is needed, which is added here. Because the PR author is more likely to require assistance with resolving this sort of problem, PR review from a maintainer is requested.
This commit is contained in:
38
.github/workflows/manage-prs.yml
vendored
38
.github/workflows/manage-prs.yml
vendored
@ -93,6 +93,7 @@ jobs:
|
||||
|
||||
outputs:
|
||||
type: ${{ steps.parse-request.outputs.type }}
|
||||
error: ${{ steps.parse-request.outputs.error }}
|
||||
arduinoLintLibraryManagerSetting: ${{ steps.parse-request.outputs.arduinoLintLibraryManagerSetting }}
|
||||
submissions: ${{ steps.parse-request.outputs.submissions }}
|
||||
index-entry: ${{ steps.parse-request.outputs.index-entry }}
|
||||
@ -133,6 +134,7 @@ jobs:
|
||||
# Due to limitations of the GitHub Actions workflow system, dedicated outputs must be created for use in
|
||||
# certain workflow fields.
|
||||
echo "::set-output name=type::$(echo "$REQUEST" | jq -r -c '.type')"
|
||||
echo "::set-output name=error::$(echo "$REQUEST" | jq -r -c '.error')"
|
||||
echo "::set-output name=arduinoLintLibraryManagerSetting::$(echo "$REQUEST" | jq -r -c '.arduinoLintLibraryManagerSetting')"
|
||||
echo "::set-output name=submissions::$(echo "$REQUEST" | jq -c '.submissions')"
|
||||
echo "::set-output name=index-entry::$(echo "$REQUEST" | jq -r -c '.indexEntry')"
|
||||
@ -156,6 +158,34 @@ jobs:
|
||||
labels: |
|
||||
- ${{ needs.parse.outputs.type }}
|
||||
|
||||
parse-fail:
|
||||
needs:
|
||||
- parse
|
||||
if: needs.parse.outputs.error != ''
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Comment on error detected while parsing PR
|
||||
uses: octokit/request-action@v2.x
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
route: POST /repos/{owner}/{repo}/issues/{issue_number}/comments
|
||||
owner: ${{ github.repository_owner }}
|
||||
repo: ${{ github.event.repository.name }}
|
||||
issue_number: ${{ github.event.pull_request.number }}${{ github.event.issue.number }}
|
||||
body: |
|
||||
|
|
||||
Hi @${{ github.actor }}
|
||||
A problem was found with your pull request:
|
||||
|
||||
${{ env.ERROR_MESSAGE_PREFIX }}${{ needs.parse.outputs.error }}
|
||||
|
||||
Please resolve this error. The checks will automatically run again once that is done.
|
||||
|
||||
More information:
|
||||
https://github.com/${{ github.repository }}/blob/main/README.md#if-the-problem-is-with-the-pull-request
|
||||
|
||||
check-submissions:
|
||||
name: Check ${{ matrix.submission.submissionURL }}
|
||||
needs:
|
||||
@ -473,7 +503,10 @@ jobs:
|
||||
not-submission:
|
||||
needs:
|
||||
- parse
|
||||
if: needs.parse.outputs.type != 'submission' # These request types can't be automatically approved.
|
||||
# These request types can't be automatically approved.
|
||||
if: >
|
||||
needs.parse.outputs.type != 'submission' &&
|
||||
needs.parse.outputs.type != 'invalid'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Comment on required review
|
||||
@ -497,6 +530,7 @@ jobs:
|
||||
unexpected-fail:
|
||||
needs:
|
||||
# Run after all other jobs
|
||||
- parse-fail
|
||||
- merge-fail
|
||||
- check-submissions-fail
|
||||
- label
|
||||
@ -548,12 +582,14 @@ jobs:
|
||||
|
||||
request-review:
|
||||
needs:
|
||||
- parse-fail
|
||||
- merge-fail
|
||||
- not-submission
|
||||
- unexpected-fail
|
||||
if: >
|
||||
always() &&
|
||||
(
|
||||
needs.parse-fail.result != 'skipped' ||
|
||||
needs.merge-fail.result != 'skipped' ||
|
||||
needs.not-submission.result != 'skipped' ||
|
||||
needs.unexpected-fail.result != 'skipped'
|
||||
|
Reference in New Issue
Block a user