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

Add ability for CLA bot to comment on PRs when user has not signed CLA #71

Open
2 of 4 tasks
filmaj opened this issue Oct 1, 2019 · 6 comments
Open
2 of 4 tasks
Labels
enhancement New feature or request

Comments

@filmaj
Copy link
Contributor

filmaj commented Oct 1, 2019

  • Use the github API to create a comment on a PR. Use e.g. the cla-bot-playground repo to test this.
  • Use the github API to retrieve comments on that PR to see what the payload looks like.
  • Comment when the user has not signed the CLA and the comment has not been made previously.
  • Comment after the user has signed the CLA and the comment has not been made previously.

constraints:

  • need to make sure the bot doesn't comment the same thing multiple times on PRs (as the PR check gets set multiple times in a typical interaction). only one comment of each kind (i.e. 'sign the cla' or 'thanks for signing the CLA').
  • worth noting that the typical listcomments API call returns 30 comments max usually.
@filmaj filmaj added the enhancement New feature or request label Oct 1, 2019
@filmaj
Copy link
Contributor Author

filmaj commented Oct 3, 2019

FYI @okorshenko this feature was not deemed desirable by some of the github.com/adobe project leads I surveyed so we would implement as something that just executes against github.com/magento projects.

Also could you confirm that the "please sign" comment would only show up for a first-time contributor to a repo? Or for all contributors regardless of their first-time status?

@filmaj filmaj self-assigned this Oct 3, 2019
@okorshenko
Copy link

Hi @filmaj that is ok to have this feature for @magento only.
We would like to see this message for those who need to sign the CLA. If CLA is already signed, we don't need to post this comment.

Yesterday I was working with one first time contributor and it was not clear for him what to do and why it is red. Comment will help. Our community already knows that if we want some action from them, instruction will be posted immediately in the comment.

Also, just FYI: I saw the cases when users signed CLA but did typo in github user name in the document so check was still red. Contributors are confused and don't understand why that happens. So we asked them check the signed document in the email and check spelling for GitHub user name.
Do you know if there is a way to pass user name from github to the document?

@filmaj
Copy link
Contributor Author

filmaj commented Oct 8, 2019

@okorshenko I spoke to the Adobe Sign team, there is unfortunately no way to pass parameters to the hosted online document 😞 that would save us a lot of trouble. This came up when I was working on the webhook implementation as well - if a parameter could be passed then that would save us a lot of work correlating signees of documents with GitHub accounts.

@filmaj
Copy link
Contributor Author

filmaj commented Oct 10, 2019

Hmm, I am getting resource not accessible for integration error when trying to post a comment as a github app. I have updated the app to have read and write permissions for issues, which should give the app the ability to post comments... I may need to engage support.

@filmaj
Copy link
Contributor Author

filmaj commented Oct 10, 2019

I have filed an issue with support over this.

@filmaj
Copy link
Contributor Author

filmaj commented Oct 16, 2019

I have received a response from GitHub support. It was a permission issue and it is resolved. Onwards!

Here is what the data payload looks like when creating a comment:

> github.issues.createComment({owner:'magento', repo:'devops-cla-test-adcb', number:105, body:'this is a test comment from the github app using the github api'}).then(function(res) { console.log(res);})
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      [Object: null prototype] {
        removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] } }
> { data:
   { url:
      'https://api.github.com/repos/magento/devops-cla-test-adcb/issues/comments/542852939',
     html_url:
      'https://github.com/magento/devops-cla-test-adcb/pull/105#issuecomment-542852939',
     issue_url:
      'https://api.github.com/repos/magento/devops-cla-test-adcb/issues/105',
     id: 542852939,
     node_id: 'MDEyOklzc3VlQ29tbWVudDU0Mjg1MjkzOQ==',
     user:
      { login: 'adobe-cla-bot[bot]',
        id: 46008225,
        node_id: 'MDM6Qm90NDYwMDgyMjU=',
        avatar_url: 'https://avatars2.githubusercontent.com/in/22537?v=4',
        gravatar_id: '',
        url: 'https://api.github.com/users/adobe-cla-bot%5Bbot%5D',
        html_url: 'https://github.com/apps/adobe-cla-bot',
        followers_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/followers',
        following_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/following{/other_user}',
        gists_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/gists{/gist_id}',
        starred_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/starred{/owner}{/repo}',
        subscriptions_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/subscriptions',
        organizations_url: 'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/orgs',
        repos_url: 'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/repos',
        events_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/events{/privacy}',
        received_events_url:
         'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/received_events',
        type: 'Bot',
        site_admin: false },
     created_at: '2019-10-16T19:21:04Z',
     updated_at: '2019-10-16T19:21:04Z',
     author_association: 'NONE',
     body:
      'this is a test comment from the github app using the github api',
     reactions:
      { url:
         'https://api.github.com/repos/magento/devops-cla-test-adcb/issues/comments/542852939/reactions',
        total_count: 0,
        '+1': 0,
        '-1': 0,
        laugh: 0,
        hooray: 0,
        confused: 0,
        heart: 0,
        rocket: 0,
        eyes: 0 } },
  status: 201,
  headers:
   { 'access-control-allow-origin': '*',
     'access-control-expose-headers':
      'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
     'cache-control': 'private, max-age=60, s-maxage=60',
     connection: 'close',
     'content-length': '1789',
     'content-security-policy': 'default-src \'none\'',
     'content-type': 'application/json; charset=utf-8',
     date: 'Wed, 16 Oct 2019 19:21:04 GMT',
     etag: '"8dcd1992b630b6e9dcee8939a539ee07"',
     location:
      'https://api.github.com/repos/magento/devops-cla-test-adcb/issues/comments/542852939',
     'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
     server: 'GitHub.com',
     status: '201 Created',
     'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
     vary:
      'Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding',
     'x-content-type-options': 'nosniff',
     'x-frame-options': 'deny',
     'x-github-media-type': 'github.squirrel-girl-preview; format=json',
     'x-github-request-id': '68C2:01E0:A792A:119098:5DA76DA0',
     'x-ratelimit-limit': '12500',
     'x-ratelimit-remaining': '12496',
     'x-ratelimit-reset': '1571257264',
     'x-xss-protection': '1; mode=block' },
  meta: [Getter] }

And here is for listing:

> github.issues.listComments({owner:'magento', repo:'devops-cla-test-adcb', number:105}).then(function(res) { res.data.forEach((c) => console.log(c.user, c.body));})
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events:
      [Object: null prototype] {
        removeListener: [Function: updateExceptionCapture],
        newListener: [Function: updateExceptionCapture],
        error: [Function: debugDomainError] },
     _eventsCount: 3,
     _maxListeners: undefined,
     members: [] } }
> { login: 'adobe-cla-bot[bot]',
  id: 46008225,
  node_id: 'MDM6Qm90NDYwMDgyMjU=',
  avatar_url: 'https://avatars2.githubusercontent.com/in/22537?v=4',
  gravatar_id: '',
  url: 'https://api.github.com/users/adobe-cla-bot%5Bbot%5D',
  html_url: 'https://github.com/apps/adobe-cla-bot',
  followers_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/followers',
  following_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/following{/other_user}',
  gists_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/gists{/gist_id}',
  starred_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/starred{/owner}{/repo}',
  subscriptions_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/subscriptions',
  organizations_url: 'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/orgs',
  repos_url: 'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/repos',
  events_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/events{/privacy}',
  received_events_url:
   'https://api.github.com/users/adobe-cla-bot%5Bbot%5D/received_events',
  type: 'Bot',
  site_admin: false } 'this is a test comment from the github app using the github api'

The above will be useful to put together the initial implementation.

@filmaj filmaj removed their assignment Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants