diff --git a/.github/ghprcomment.yml b/.github/ghprcomment.yml index c1dea4cc03d..c27ca0c6db9 100644 --- a/.github/ghprcomment.yml +++ b/.github/ghprcomment.yml @@ -154,7 +154,16 @@ See [CONTRIBUTING.md](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md#pull-request-process) for more details. -# PR text +# PR hygiene + +- jobName: 'Ensure that contributor is assigned (fails if not commented on issue)' + workflowName: 'On PR opened/updated' + message: > + You did not assign yourself to the issue. + Thus, it looks like you skipped reading our [CONTRIBUTING.md](https://github.com/JabRef/jabref/blob/main/CONTRIBUTING.md), which explains exactly how to participate. No worries, it happens to the best of us. + + + Give it a read, and youโ€™ll discover the ancient wisdom of assigning issues to yourself. Trust me, itโ€™s worth it. ๐Ÿš€ - jobName: 'PR title must not start with "Fix for issue "' workflowName: 'PR Tests' diff --git a/.github/workflows/on-pr-opened-updated.yml b/.github/workflows/on-pr-opened-updated.yml index c69194fea5f..fbeb6e68491 100644 --- a/.github/workflows/on-pr-opened-updated.yml +++ b/.github/workflows/on-pr-opened-updated.yml @@ -85,6 +85,7 @@ jobs: skip-if-not-in-project: true ensure_assignment: name: Ensure that contributor is assigned (fails if not commented on issue) + if: github.event.pull_request.head.repo.full_name != 'JabRef/jabref' # after determine_issue_number to ensure that there is only one failure because of no ticket number needs: determine_issue_number runs-on: ubuntu-latest @@ -114,10 +115,22 @@ jobs: # Append the new assignee UPDATED_ASSIGNEES=$(echo "$ASSIGNEES" | jq --arg new "${{ github.event.pull_request.user.login }}" '. + [$new]') + LABELS=$(gh api repos/${{ github.repository }}/issues/${{ needs.determine_issue_number.outputs.issue_number }}/labels --jq '.[].name') + if echo "$LABELS" | grep -q "^good"; then + echo "โœ… label good found" + SILENT=false + else + echo "๐Ÿšซ Silent fail if not possible to add assignee" + SILENT=true + fi + # Update issue with the new assignee list echo "Updating issue #${{ needs.determine_issue_number.outputs.issue_number }} updated with assignees: $UPDATED_ASSIGNEES..." - gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}") - + if [ "$SILENT" = true ]; then + gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}") || true + else + gh api -X PATCH /repos/JabRef/jabref/issues/${{ needs.determine_issue_number.outputs.issue_number }} --input <(echo "{\"assignees\": $UPDATED_ASSIGNEES}") + fi env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Add label "๐Ÿ“Œ Pinned"