JJ / github-pr-contains-action

Action that checks whether the body or diff in a PR contains a certain word.
MIT License
29 stars 33 forks source link

WaivedUSers does not work #106

Closed eccles closed 5 months ago

eccles commented 11 months ago
name: "Verify Linked Task"

on: [pull_request]

jobs:
  check_pr:
    runs-on: ubuntu-latest
    steps:
      - name: Check PR
        uses: JJ/github-pr-contains-action@releases/v11
        with:
          github-token: ${{github.token}}
          bodyContains: "AB#\\d{4,5}"
          waivedUsers: ["dependabot[bot]"]

returns error

Invalid workflow file

The workflow is not valid. .github/workflows/verify-azure-issue.yml (Line: 14, Col: 24): A sequence was not expected

eccles commented 11 months ago

Additionally the example in the README is still at v10

JJ commented 11 months ago

Thanks for the report. Will check momentarily. Most probably a documentation error, but will check anyway. BTW, dependabot is waived by default, so you don't really need to insert that explicitly (but that's in the documentation, so it's partially my fault)

JJ commented 11 months ago

Well, TIL that action inputs can't be arrays. Some refactoring is in order, I guess. Thanks again for the report.

eccles commented 11 months ago

thanks for the attention - :-)

eccles commented 11 months ago
name: "Verify Linked Task"

on: [pull_request]

jobs:
  check_pr:
    runs-on: ubuntu-latest
    steps:
      - name: Check PR
        uses: JJ/github-pr-contains-action@releases/v11
        with:
          github-token: ${{github.token}}
          bodyContains: "AB#\\d{4,5}"
          waivedUsers: |
            "dependabot[bot]"

does not raise any errors

JJ commented 11 months ago

But it's not going to work, either, since it expects an array. Will need to refactor anyway. Thanks for checking.

mmaietta commented 5 months ago

Note, a workaround for this is to just use a basic | operator between waivedUsers entries since String.prototype.includes() is a function as well and I don't think Github allows users with | in the name? https://github.com/JJ/github-pr-contains-action/blob/7de34814e81733585d01e8491c2014a2b8b83942/src/main.ts#L40-L41 For instance:

waviedUsers: 'some-user|dependabot[bot]'

If this workaround is acceptable for this project, I would just recommend updating the docs and changing the ["dependabot[bot]"] code to be a string instead of an array

JJ commented 5 months ago

Thanks; will take a look soon-ish