JJ / github-pr-contains-action

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

Great idea #56

Closed paulca99 closed 1 year ago

paulca99 commented 3 years ago

I'm having a bit of trouble running it though, I have 2 jobs on my PR action, your action seems to work OK , but always fails at the end with "Error: Not Found" , is it because I have a 2nd job ?

name: 'Terraform GitHub Actions'
on:
  - pull_request
jobs:
  check_pr:
    runs-on: ubuntu-latest
    steps:
    - name: Check PR
      uses: JJ/github-pr-contains-action@releases/v0
      with:
        github-token: ${{github.token}}
        bodyContains: '[x]'
        bodyDoesNotContain: 'Delete this'
        diffContains: ''
        filesChanged: 1
        linesChanged: 1
  terraform:
    name: 'Terraform'
    runs-on: ubuntu-latest
    steps:
      - name: 'Checkout'
        uses: actions/checkout@master
      - name: 'Terraform Format'
        uses: hashicorp/terraform-github-actions@master
        with:
          tf_actions_version: 1.0.0
          tf_actions_subcommand: 'fmt'

        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

image

JJ commented 3 years ago

Sorry, I missed this the first time. Let me check this and get back to you. Sorry for the delay.

amitasinha1 commented 2 years ago

any resolution on this? I'm having the same issue, only using bodyDoesNotContain and getting Error: Not found

marutinandanpandya commented 2 years ago

+1 Facing the same issuu

Screenshot 2022-08-09 at 6 10 53 PM
JJ commented 2 years ago

Just back from the holidays, will have to take a look. The fact that someone else is actually using this was rather unexpected

JJ commented 2 years ago

@marutinandanpandya is it the same environment for you? Also two independent jobs?

JJ commented 2 years ago

Sorry for being so extraordinarily late @paulca99 could you please point me to the repo and action, so that I can see a bit more of the context?

JJ commented 2 years ago

Also, @paulca99, could you please check with v4? It's possibly fixed already in that version; IIRC, it failed if some key was missing.

amitasinha1 commented 2 years ago
Screen Shot 2022-08-15 at 7 11 16 PM

this is what i have and then creating a pr that only contains first_name, but still getting error:not found @JJ

JJ commented 2 years ago

I would say it's because of the empty strings in bodyContains and diffContains. I've produced a new version that should take care of diffContains, can you please check? Or, if it's a public repo, can I fork it and try to work it out?

amitasinha1 commented 2 years ago

@JJ got it to work in a public repo, amazing! But I noticed it gives me that same error:not found if i use it in a private repo. Is there anyway around this? Also I need to use this for where the diff does not contain keywords and I realized this only works for diffContains. Is there any way you could add diffDoesNotContain? I hope it's not too heavy of a lift

amitasinha1 commented 2 years ago

@JJ also if i wanted to do multiple strings, can it take an array or no?

JJ commented 2 years ago

@amitasinha1 that's requested in #59, and the second in #32. I'll check about the private repo, I have no idea what it can be. It's possible that you need another level for the GitHub token. I'll try and check in a private repo to see what's the problem.

amitasinha1 commented 2 years ago

@JJ did #59 end up getting implemented? I see it as open still. Regarding #32, I get an error when i try to make it an array

Screen Shot 2022-08-17 at 9 25 57 AM
JJ commented 2 years ago

No, it wasn't, still open... I guess I'll have to get around to do it.

amitasinha1 commented 2 years ago

@JJ i'm not too familiar with js but i can try updating it? which file is the code in so i can open a pr?

JJ commented 2 years ago

Pretty much around here

https://github.com/JJ/github-pr-contains-action/blob/master/src/main.ts#L21

The problem is that it would need some refactoring, checking if the value is a string or an array, and so on. PRs are very welcome, of course.

paulbakkerbloom commented 1 year ago

Hi @JJ, have you gotten round to fixing the issue? I still get the Error: Not found -- also working in a private repo

JJ commented 1 year ago

Well, as a matter of fact I was cleaning browser tabs today and I kept this open, so I guess it's about time I work on this...

paulbakkerbloom commented 1 year ago

Awesome! Do you have any idea when you'll have the time to work on it?

JJ commented 1 year ago

Should be any time soon, maybe today. Before early next week, at any rate.

paulbakkerbloom commented 1 year ago

Awesome, good luck!

JJ commented 1 year ago

This specific thing is being addressed in #32 . I'll be doing a release pretty soon.

JJ commented 1 year ago

Can you please try latest v7, to see if that works for you? #32 is implemented, diffDoesNotContain coming up... Anyway it's addressed in #59.

JJ commented 1 year ago

Please check that it solves your problem, reopen (or open a separate issue) if it does not.