This is a basic campaign form to submit issues to a GitHub repository. This has previously been used in campaigns such as Firefox Foxfooding and FxA testing. These campaigns previously lived in separate repos, upcoming campaigns will be handled in this repository as they come up.
Note that this form is basic and might not support everything you need. Several parts could be abstracted, however these campaigns are mostly short-lived and code gets adjusted as needed. PRs are welcome though!
lib/githubBackend.js
Then you can start the server with the following command. Make sure to replace the placeholders with your data.
$ git clone <URL>
$ cd campaign-form
$ npm ci
$ GITHUB_TOKEN=<yourGitHubToken> OWNER=<yourGitHubUsername> REPO=<yourGitHubRepoForIssues> SESSION_SECRET=someSECRET BASE_URL=http://localhost:4000/ AWS_ACCESS_KEY_ID="<yourAWSAccessKeyID" AWS_SECRET_ACCESS_KEY="<yourAWSAccessKey>" AWS_S3_BUCKET_NAME="<yourAWSS3BucketName>" npm start
Note: you can leave off the AWS configuration, however attachments won't be uploaded and won't be shown in the resulting GitHub issue.
Now you can access the website for it at localhost:4000
.
The following environment variables are needed. Note that you will need to set these up in Heroku as well!
Variable | Description | Example |
---|---|---|
AWS_ACCESS_KEY_ID | AWS Access Key ID to upload attachments | ... |
AWS_SECRET_ACCESS_KEY | AWS Access Key Secret to upload attachments | ... |
AWS_S3_BUCKET_NAME | AWS S3 Bucket name to upload attachments to | campaign-form-uploads |
BASE_URL | URL of the form | https://foxfooding-form.mozilla.community/ |
GITHUB_TOKEN | Token for the GitHub user to post issues | ... |
OWNER | GitHub username / organization hosting the reporting repo | mozilla |
REPO | GitHub repository name to host the issues | campaign-form |
SESSION_SECRET | Random string used as session secret | foobarbaz.... |
fields_config.json
file and adjust if neededlib/formHandling.js
to work together with the defined fieldsviews/index.pug
to reflect correct strings and fields (if a previous campaign got stopped, you might need to revert previous changes to get back the form fields and then adjust them)public/
and its alt text in views/index.pug
views/layout.pug
lib/githubBackend.js
to adjust possible version / OS GitHub labels and create them in the GitHub issues repopublic/client.js
if any fields need pre-filling (such as UA)public/style.css
if neededmozilla-campaign-form-bot
GitHub user as collaborator to issues repository