adobe / cla-bot

GitHub App that checks contributors have signed Adobe's CLA (or are Adobe/Magento employees)
https://github.com/apps/adobe-cla-bot
Apache License 2.0
6 stars 13 forks source link

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

Open filmaj opened 5 years ago

filmaj commented 5 years ago

constraints:

filmaj commented 5 years ago

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?

okorshenko commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

I have filed an issue with support over this.

filmaj commented 4 years ago

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.