Expose Github account’s email address as public when using OAuth 2 authentication

What to do

When  a application uses Github OAuth 2 authentication, some of accounts may lost its email address in a application. The reason is that Github account keep it’s email address as ‘Private‘.

In order to use Github account’s email address on Gerrit, a user have to make it as Public

  1. Go to ‘http://github.com/ > Setting > Emails’
    • Link: https://github.com/settings/emails/
  2. Uncheck ‘Keep my email address private’

Reference

 

 

Advertisements

Python: Tips to support both Python 2 and Python3

  1. Use ‘.decode’ and ‘str’ methods
    #Converts base64-encoded bytes to string
    import base64
    data = str(
        base64.b64decode(commit_msg_hook).decode("utf-8")
    )
    
  2. Use ‘stat’ module to change file’s permission
    import os
    import stat
    os.chmod('./run.sh', stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
    
  3. Don’t use ‘urllib2’ module. It’s only available for Python 2
    Use ‘requests’ module


	

Get JIRA issue key when using ‘Script Runner’ groovy script in a JIRA workflow transition

If you need to get a current issue’s key value and you use ‘groovy’, you can use this code

import com.atlassian.jira.issue.Issue

Issue issue  = issue

issueKey =  issue.getKey()