nucleuscloud / neosync

Open source data anonymization and synthetic data orchestration for developers. Create high fidelity synthetic data and sync it across your environments.
https://www.neosync.dev
MIT License
2.93k stars 102 forks source link

NEOS-1237: add github action for checking pr label #2306

Closed frankie-mur closed 1 month ago

frankie-mur commented 1 month ago

This PR adds a new Github Action, the action checks if there is atleast one PR label present, if not it makes a comment in the PR. This PR addresses issue #2294

Example:

vercel[bot] commented 1 month ago

@frankie-mur is attempting to deploy a commit to the neosync Team on Vercel.

A member of the Team first needs to authorize it.

frankie-mur commented 1 month ago

Hey @nickzelei, thanks! I learned alot about GH actions in the process 👍

nickzelei commented 1 month ago

@frankie-mur I believe you need to configure the permissions block to allow the action to comment on the PR. Can read more about it here: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs We have these configured in a few different actions in this repo, but none for commenting. Could serve as a starting point though.

The action may have just not run because you are an outside collab. I have to manually approve. That could be it...because I was thinking the same thing you specified labeled and unlabeled. It might work differently if I open a PR myself.

nickzelei commented 1 month ago

@frankie-mur Looks like the job runs correctly when the label is added or removed! But still receiving a 403. I left a comment with a snippet of where I believe the permissions block needs to be moved to!

frankie-mur commented 1 month ago

@nickzelei appreciate the suggestion! I have moved the permission block over. Lets try that again 🤞

nickzelei commented 1 month ago

ok @frankie-mur it still didn't work. I did a little research, and it appears we have the wrong permissions. What we actually need is issues: write as github treats PRs as a special type of issue and the ability to comment is actually underneath the issues section instead of pull requests (so confusing!!). I don't believe we need pull-requests: write at all.

Anyways, maybe let's give that a go.

frankie-mur commented 1 month ago

oh wow, that is a bit confusing. Thank you for you patience in this and also doing the (very) manual testing! 😂

nickzelei commented 1 month ago

All good! I'm learning something too. I'm not sure why, but it's still failing.

I wonder if it's really worth it at this point to have this. The job failing might be sufficient.

nickzelei commented 1 month ago

I would assume the github token doesnt need to be explicitly specified? I read a little about the github client and it says it should find it from the context.

frankie-mur commented 1 month ago

Thats unfortunate! I have removed the add a comment job and made the job Name to be more specific