Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scan PR Changed Files For "random" #35

Closed
wants to merge 17 commits into from

Conversation

yonatanaftali
Copy link

@yonatanaftali yonatanaftali commented Jan 16, 2023

This PR created for solving #4

@yonatanaftali yonatanaftali changed the title added github action Scan PR Changed Files For "random" Jan 16, 2023
@yonatanaftali
Copy link
Author

@itaitzruia4 Hey, can you please take a look at this?

@yonatanaftali
Copy link
Author

@itaitzruia4 ? :)

@yonatanaftali
Copy link
Author

Closing this but keeping the branch. Feel free to reopen it if still relevant.

@itaitzruia4
Copy link
Collaborator

Sorry for not replying, can you show us it works by tests or in another way?

@yonatanaftali yonatanaftali reopened this Mar 7, 2023
@yonatanaftali
Copy link
Author

Sorry for not replying, can you show us it works by tests or in another way?

I can't write tests for this or run this action because it opened from a forked repo. However, I can show you this:
The main logic of this action is the following code:

git diff HEAD..origin/main | grep -i -n "random" > detections.txt
if [ -s detections.txt ]; then
  cat detections.txt
  echo "RANDOM_DETECTED=true" >> $GITHUB_OUTPUT
fi
  1. Open a branch called test from main.
  2. Create/Edit a file, and include the word random somewhere in it.
  3. To simulate a local run, run the above code, replacing $GITHUB_OUTPUT with env.txt.
  4. You will get a similar output to this:
    image
    --> meaning the word random was detected, thus leading to a comment on the PR.

The best way to see it is to merge this PR, and then open a new PR to main with the word random it - you'll see the alert immediately.

@itaitzruia4 itaitzruia4 requested a review from achiyae May 19, 2024 07:27
@achiyae achiyae changed the base branch from main to develop May 24, 2024 18:58
@achiyae achiyae mentioned this pull request May 24, 2024
@achiyae
Copy link
Contributor

achiyae commented May 24, 2024

Merged this PR via #109
Closing here

@achiyae achiyae closed this May 24, 2024
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.

None yet

3 participants