GitHub is a really great platform but not every body have a GitHub account so when we decided to use GitHub to manage the user issues for ezFlow, we needed a way to allow non GitHub users to publish issues. As we love Google Apps Script we decide to publish a Google forms with an apps script to send anonymous issues.
It is quite simple, users will be able to raise new issue by feeling a Google Forms and when they will hit submit button, the issue will be send to GitHub and an email will be sent to him with link of issue to allow him to track progress.
Weakness of this tool is the issue will be publish with your GitHub account, so in the Issues page, only your name will be shown.
1) Create a Google Forms with 3 fields : Title, Message and Email. Like the one below :
Warning : In the code we use the name of fields to identify dynamically elements, so if you change fields name you have to update the code !
2) In the form created go to « Script Editor » by clicking on the 3 dots at the top right. Once in script editor, set a name and go to « Resources >> Libraries … » and add OAuth2 library (link), if you are used to deal with library, here the ID : 1B7FSrk5Zi6L1rSxxTDgDEUsPzlukDsi4KGuTMorsTQHhGBzBkMun4iDF
3) Copy paste code from this GitHub page : link
Important : For the OAuth code we use the code provided in the sample page of the OAuth2 library but we have to set the scope. So for our need only repo scope is needed
4) Setup your application on GitHub to get your Client_Id and Client_Secret. On GitHub go to your settings and menu « OAuth applications », direct link : here.
Click on « Register a new application » button at the top right. The Authorization callback URL must be like that : https://script.google.com/macros/d/Script_ID/usercallback
To get your Script_ID go to « File >> Project properties ».
Fill others details and copy/paste Client_Id and Client_Secret generated in the code page of your script.
5) Now launch the function run(). As you don’t have credentials you have to validate them. Go to the logger, menu « View >> Logs ». Copy paste url displayed in a browser window and validate the access.
After re-launch the run() function and you will get details of your account. Access is now ok.
6) To finalise in the code page you have to enter OWNER and REPO for the project you want to push issues.
Then setup a trigger by going to the menu « Resources >> Current projet’s triggers », select function manageAnswer > From form > On form submit.
7) Go to live form (click eye icon), fill it and submit.
User who submit the issue will receive an email with information added and a new issue is created in the project.