JJ / github-pr-contains-action

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

DiffContain functionality concern #51

Closed ayush-sleepycat closed 1 year ago

ayush-sleepycat commented 3 years ago

I was trying to use diffContain but it is not working the way I expected. As per my understanding, it will check the code diff for the text and see if it is present or not. I tried to check for a random text in the code base but it passed: https://github.com/ayush-sleepycat/test-repo/pull/1/checks?check_run_id=1362665275 Is there something I am missing here.

JJ commented 3 years ago

Let me take a look. Thanks for your report.

JJ commented 3 years ago

In this case, the diff contains "ayush gupta", in one of the files you have changed, which is why it does not fail. The diff includes all changes in all files.

JJ commented 3 years ago

I can maybe add some info to the output, indicating the line where it's been found, if you consider it convenient.

ayush-sleepycat commented 3 years ago

I just realised the issue. My PR contained the change in YAML file which contains the word I want to check and technically it will always be there. I added a new PR and the check worked. But failure information (maybe the diff line which contains the text) would be helpful.

On a separate note, I wanted to use Actions in a similar way but with a different requirement. Here a few details, if you can tell me how to get that implemented:

JJ commented 1 year ago

Those seem to be separate issues (and sorry for being so late answering, late 2020 was complicated for me). I'll to open different issue to address them. Do you mind if I close this issue?

JJ commented 1 year ago

I just realised the issue. My PR contained the change in YAML file which contains the word I want to check and technically it will always be there. I added a new PR and the check worked. But failure information (maybe the diff line which contains the text) would be helpful.

On a separate note, I wanted to use Actions in a similar way but with a different requirement. Here a few details, if you can tell me how to get that implemented:

* Fail if certain text is available in the code (for example we want to add a check to avoid our staging URLs which sometimes are pushed to prod)

That's requested in #59. I'll follow up there, if you don't mind.

* Add more than one text string (basically check an array of string which is a part of the issue you have created already)

That's been addressed in #32.

* Have these checks on PR as well as on direct code push. ( I think that is also possible with actions)

This action is using the PR payload to analyze. Working on direct code push would require a very different approach, possibly starting from scratch.

If you don't mind (you probably don't, since I've been so terribly late answering this), I'll close this issue in favor of the others mentioned.