Skip to content

Conversation

@selul
Copy link

@selul selul commented Apr 24, 2021

Hi there,

I have played recently with this action and I have found a few things where I could help.

  • Improve issue validation using issue-parser package, which now detects cross-repo issues ( full URL ), ie.https://github.com/hattan/verify-linked-issue-action/issues/29 as well as shorthand ones, #issue_number
  • The issue referenced in the PR sidebar ( connected events ) was not working properly since it was returning inside forEach not inside the main function, possible connected to add ability to detect issue referenced in sidebar #22
  • Add output for action has_linked_issues which can be used in other steps/jobs.
  • Added one args as quiet which prevent action for failing, allowing you to use the output in other steps
  • Added one arg as no_comment which prevent the action from adding the comment. quiet argument automatically for this as true.

Let me know if you find those useful.

P.S one example where I used the output is this:

name: Verify PR

on:
  pull_request:
    types: [ edited, synchronize, opened, reopened ]

jobs:
  verify_linked_issue:
    runs-on: ubuntu-latest
    if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]'
    name: Ensure Pull Request has a linked issue.
    steps:
      - name: Verify Linked Issue
        id: verify_linked_issues
        uses: Codeinwp/verify-linked-issue-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
        with:
          quiet: 'true'
      - name: Find Comment
        uses: peter-evans/find-comment@v1
        id: find_coomment
        with:
          issue-number: ${{ github.event.pull_request.number }}
          comment-author: 'pirate-bot'
          body-includes: No Linked Issue found
      - name: Create or update comment
        uses: peter-evans/create-or-update-comment@v1
        if: steps.verify_linked_issues.outputs.has_linked_issues != 'true'
        with:
          comment-id: ${{ steps.find_coomment.outputs.comment-id }}
          token: ${{ secrets.BOT_TOKEN }}
          issue-number: ${{ github.event.pull_request.number }}
          body: |
            :guardsman: PR Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>
          edit-mode: replace
      - name: Fail action on no issue found
        if: steps.verify_linked_issues.outputs.has_linked_issues == 'false'
        run: exit 1;
      - name: Delete comment
        uses: jungwinter/comment@v1
        if: steps.verify_linked_issues.outputs.has_linked_issues == 'true' && steps.find_coomment.outputs.comment-id != ''
        with:
          type: delete
          comment_id: ${{ steps.find_coomment.outputs.comment-id }}
          token: ${{ secrets.BOT_TOKEN }}

selul added 6 commits April 24, 2021 00:07
* improve issue string parsing
* add output for issues linking state
* fix connected issue workflow
@laurencejackson
Copy link

laurencejackson commented Jan 24, 2022

Thanks for this @selul and @hattan, these features look really helpful! Do you know if there are any plans for a new release with these changes merged soon?

I'm especially interested in detecting the linked issues in the sidebar (#22). It would be really great to have functionality that checks only the sidebar and ignores the comments. This would be so we can check that each PR has a primary linked issue for quality management purposes.

@melloware
Copy link

This project looks dead I wonder if we should fork this project and keep it up to date with things like this and ignoring Dependabot PR's etc??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants