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
added support for task lists #460
Conversation
@prayerslayer I solved the commit message problem with this one. I forked this repo as
Then through the UI, I first verify that zappr is able to read zappr config from the repo, then enable new hook for PR Tasks, check that it started protecting master branch and created the hook at I also added debug lines into |
Hmm that sounds correct. Can you verify it works manually using the same token that Zappr uses? Regarding the failing test, what's the output of |
@prayerslayer I confirm it works with the token Zappr uses. Maybe the issue is related to my dev environment since I'm using SSH tunnels for the sake of easy development instead of deploying it to some server. I was using node 6.7.0 :) I'll try with 5.7, thanks! |
Uh, I don't know enough about SSH tunnels to comment on that, I'm afraid... We use localtunnel to make our dev environment on localhost available to Github:
Don't forget to change your OAuth app settings accordingly. |
Hey, I wanted to follow up on this. Did you try my suggestion? Did you get it to run otherwise? |
Hi @prayerslayer, Sorry I didn't have time to look at it. I'll try and let you know about it asap. |
Take your time, I just wanted to know the status :) |
@prayerslayer it worked :) thanks! i'll add the tests now. |
125b5ad
to
98e36e8
Compare
Hi All, This PR is now ready for a review. :) Thanks! |
@@ -0,0 +1 @@ | |||
5.7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this come from? Which tools is supposed to pick it up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for nodenv (for managing node versions). It automatically picks up the correct node version once you enter into the directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. Personally I use nvm
for that purpose, so let's also add a .nvmrc
😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you add it because I've never used nvm
before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would need write access to your fork, no? It's the same content and the filename is .nvmrc
. https://github.com/creationix/nvm#nvmrc
const debug = logger(CHECK_TYPE) | ||
const createStatePayload = getPayloadFn(CONTEXT) | ||
|
||
export function hasOpenTasks(pr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe only pass the PR body as parameter? Everything else is just for logging which you can do outside of the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When printing debug messages, I'm doing it inside the loop and to seperate those lines from other PR's I need to include repoName and prNo so that prevents me from just including pr body.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, got it. I really don't like passing a full-fledged PR object into a function that's supposed to work on a string. Can we add repoName and prNo as optional parameters?
function hasOpenTasks(prBody, repoName = '', prNumber = '') {
...
}
let msg; | ||
|
||
if (hasOpenTasks(pull_request)) { | ||
msg = `${fullName}#${number}: Failed the PR due to open tasks.`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't include repo name and PR number in status message, we also don't do it in other checks.
As for messages, what about "PR has ${openTasks} open tasks." in case of failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change the code accordingly.
let status; | ||
|
||
try { | ||
// TODO: configuration settings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact I couldn't think of any settings at all for this feature. It's only about enabling/disabling it at this moment. But I placed a TODO just in case someone wants to add some configuration flags in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then let's just remove that TODO. Looks like we forgot something.
@prayerslayer Added requested changes. |
|
||
try { | ||
if (pull_request.state === 'open' && ['opened', 'edited', 'reopened'].indexOf(action) !== -1) { | ||
let openTaskCount = countOpenTasks(pull_request.body, repoName, number); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry if my suggestion was misleading. Putting the fullName inside there is a good idea as it's otherwise hard to distinguish different repos with the same name.
Done 😄 |
Looks good! We now need to write a concise info text for the frontend (see RepositoryCheck.jsx and some documentation). Then it's done! |
@prayerslayer do you expect anything else from me? is it something i should do? |
Hm not really, I can write the docs myself :) I'll wait for the build to finish and see to get it merged. |
👍 |
1 similar comment
👍 |
Thanks for the effort @tunix! |
Hi Everyone,
I've added support for task lists in pull requests. I haven't written the tests yet, but I'll. But before that, can somebody help me with the following problem?
During development, when I make a request for failing the commit, I'm getting 404 from GitHub API. But when I try the same request manually on the console, I'm getting 200 OK. Below is my request details. Can someone please help me with that?
I'm getting below log when I try it through zappr:
I'm also getting following error when I run tests against the server: