Skip to content

Commit 80eb0f2

Browse files
Remove changlog labels (#314)
* Remove changlog labels * Fix tests * Fix tests * Fix some tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix tests * Fix stuff * Fix tests * Fix tests * Remove .idea * Improve coverage * Use Ubuntu 22.04
1 parent fb0a435 commit 80eb0f2

33 files changed

+7972
-6703
lines changed

.github/workflows/eslint_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [ubuntu-18.04]
15+
os: [ubuntu-22.04]
1616
steps:
1717
- uses: actions/checkout@v2
1818
- uses: actions/setup-node@v1

.github/workflows/frontend_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [ubuntu-18.04]
15+
os: [ubuntu-22.04]
1616
steps:
1717
- uses: actions/checkout@v2
1818
- uses: actions/setup-node@v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ node_modules
22
npm-debug.log
33
*.pem
44
.env
5+
.idea
56
newrelic_agent.log
67
.nyc_output
78
coverage

.nycrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"branches": 87,
2+
"branches": 90,
33
"lines": 100,
44
"functions": 100,
55
"statements": 100,

README.md

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,12 @@
66

77
Oppiabot is a GitHub app built with [probot](https://github.com/probot/probot). It acts as a helper for the Oppia code repository to maintain the development workflow. It is hosted on [Heroku](https://www.heroku.com/).
88

9-
The bot currently performs the following functions:
10-
11-
1. Checks whether a contributor creating a pull request has signed the CLA. It adds a label `Needs CLA` accordingly.
12-
13-
2. Checks merge conflict in a pull request and notifies the author of the pull request if there is a merge conflict.
14-
15-
3. Closes stale pull requests.
16-
179

1810
## Getting started
1911

2012
Please refer to the following instructions to setup Oppiabot for the first time on your machine:
2113

22-
1. Create a new, empty folder called `opensource/` within your home folder. Navigate to it (`cd opensource`), then [fork and clone](https://help.github.com/articles/fork-a-repo/) the Oppiabot repo. This will create a new folder named `opensource/oppiabot`. Navigate to `opensource/oppiabot/`.
14+
1. Create a new folder called `opensource/` within your home folder (or use one that you already have). Navigate to it (`cd opensource`), then [fork and clone](https://help.github.com/articles/fork-a-repo/) the Oppiabot repo. This will create a new folder named `opensource/oppiabot`. Navigate to `opensource/oppiabot/`.
2315

2416
2. Install [Node.Js](https://nodejs.org/) and [NPM](https://www.npmjs.com/) on your machine using the following commands:
2517

@@ -32,13 +24,7 @@ Please refer to the following instructions to setup Oppiabot for the first time
3224
#### Using Ubuntu
3325
```bash
3426
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
35-
sudo apt-get install -y nodejs
36-
```
37-
38-
#### Using Debian, as root
39-
```bash
40-
curl -sL https://deb.nodesource.com/setup_lts.x | bash -
41-
apt-get install -y nodejs
27+
sudo apt install -y nodejs
4228
```
4329

4430
#### Using MacOS
@@ -47,7 +33,7 @@ Please refer to the following instructions to setup Oppiabot for the first time
4733
```
4834

4935
#### Using Windows
50-
Install using following [link](https://nodejs.org/en/download/). (Its always preferred to use LTS Version).
36+
Use [WSL with Ubuntu](https://learn.microsoft.com/en-us/windows/wsl/install) and then follow the Ubuntu instructions.
5137

5238
3. Setup probot and other dependencies by running the following command:
5339
```bash
@@ -56,10 +42,6 @@ Please refer to the following instructions to setup Oppiabot for the first time
5642

5743
4. The Oppiabot uses environment variables. These are configured in the server settings. To deploy the bot locally, create a `.env` file and copy the contents of `.env.example` to it. You will need to adjust these variables accordingly following the instructions in the subsequent steps. Run following command to copy `.env.example` to `.env`
5844

59-
If you're using Windows cmd, go to Oppiabot folder and type:
60-
``` bash
61-
copy .env.example .env
62-
```
6345
If you have Linux terminal type:
6446
```bash
6547
cp .env.example .env
@@ -68,33 +50,36 @@ If you have Linux terminal type:
6850
5. Go to [smee.io](https://smee.io/) and click **Start a new channel**. Set `WEBHOOK_PROXY_URL` in `.env` to the URL that you are redirected to.
6951

7052
6. [Create a new GitHub App](https://github.com/settings/apps/new) with:
53+
* **GitHub App name**: Use something like "My Oppiabot testing App"
54+
* **Homepage URL**: Use any random URL
7155
* **Webhook URL**: Use your `WEBHOOK_PROXY_URL` from the previous step.
7256
* **Webhook Secret**: `development`
73-
* **Permissions & events** The following permissions and events must be subscribed.If, for example, you only enable issue events, you will not be able to listen on pull request webhooks with the bot.
57+
* **Permissions & events** The following permissions and events must be subscribed. If, for example, you only enable issue events, you will not be able to listen on pull request webhooks with the bot.
7458

7559
<p align="center">
76-
<img src="images/docs/repository-permissions.png">
77-
<img src="images/docs/other-permissions.png">
60+
<img src="images/docs/repository_permissions.png">
61+
<img src="images/docs/organization_permissions.png">
62+
<img src="images/docs/account_permissions.png">
7863
<img src="images/docs/events.png">
7964
</p>
8065

8166
7. Download the private key. It will be a `.pem` file. Move it to the root directory of the project. As long as it's in the root directory, it will be automatically detected regardless of the filename.
8267
8368
Make sure you remove
8469
> PRIVATE_KEY=example_private_key
70+
8571
from .env file, Otherwise app will not work locally.
8672
87-
8. Edit `.env` and set `APP_ID` to the ID of the app you just created. The App ID can be found in your app settings page here.
73+
8. Edit `.env` and set `APP_ID` to the ID of the app you just created and also `WEBHOOK_SECRET` to `development`. The App ID can be found in your app settings page here.
8874
8975
<p align="center">
90-
<img src="images/sample-app-id.png">
76+
<img src="images/docs/sample_app_id.png">
9177
</p>
9278
9379
9480
## Installing the bot on a repository
9581
96-
You'll need to identify a target repository and install the bot by clicking the **Install** button on the settings page of your app, e.g `https://github.com/apps/your-app-name`. In the `.env` file put your github account name in
97-
`WHITELISTED_ACCOUNTS` and also add your repository (name in small caps) in the `constants.js` file locally.
82+
You'll need to identify a target repository and install the bot by clicking the **Install** button on the settings page of your app, e.g `https://github.com/settings/apps/my-oppiabot-testing-app/installations`. In the `.env` file put your github account name in `WHITELISTED_ACCOUNTS` and also add your repository (name in small caps) in the `constants.js` file locally.
9883

9984

10085
## Running the bot locally
@@ -104,12 +89,12 @@ The `dev` script will start the bot using [nodemon](https://github.com/remy/node
10489

10590
### Other available scripts
10691

107-
`$ npm start` to start the bot without watching files.
92+
`npm start` to start the bot without watching files.
10893

10994

11095
## Debugging
111-
Always run `$ npm install` and restart the server if `package.json` has changed.
112-
To turn on verbose logging, start server by running: `$ LOG_LEVEL=trace npm start`.
96+
Always run `npm install` and restart the server if `package.json` has changed.
97+
To turn on verbose logging, start server by running: `LOG_LEVEL=trace npm start`.
11398
Run `npm test` to run all the tests locally.
11499

115100

actions/src/issues/checkIssueLabels.js

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,11 @@ const handlePRLabel = async (octokit, label, user) => {
9494
const link = linkText.link(
9595
'https://github.com/oppia/oppia/wiki/Contributing-code-to-Oppia#' +
9696
'labeling-issues-and-pull-requests');
97-
let commentBody = '';
98-
if (label.startsWith('PR CHANGELOG')) {
99-
// Handle case for a changelog label.
100-
commentBody = (
101-
'Hi @' + user + ', changelog labels should not be used on issues.' +
102-
' I’m removing the label. You can learn more about labels ' + link +
103-
'. Thanks!');
104-
} else {
105-
commentBody = (
106-
'Hi @' + user + ', the ' + label + ' label should only be used in ' +
107-
'pull requests. I’m removing the label. You can learn more about ' +
108-
'labels ' + link + '. Thanks!');
109-
}
110-
97+
const commentBody = (
98+
'Hi @' + user + ', the ' + label + ' label should only be used in ' +
99+
'pull requests. I’m removing the label. You can learn more about ' +
100+
'labels ' + link + '. Thanks!'
101+
);
111102
await octokit.issues.createComment(
112103
{
113104
body: commentBody,

constants.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const issueCommentCreatedEvent = 'comment_created';
3434
const periodicCheck = 'periodic-check';
3535
const claCheck = 'cla-check';
3636
const claCheckGithubAction = 'cla-check-github-action';
37-
const changelogCheck = 'changelog-check';
3837
const datastoreLabelCheck = 'datastore-label-check';
3938
const prLabelCheck = 'pr-label-check';
4039
const hotfixLabelCheck = 'hotfix-label-check';
@@ -79,8 +78,8 @@ const checksWhitelist = {
7978
// eslint-disable-next-line quote-props
8079
'oppia': {
8180
[openEvent]: [
81+
assigneeCheck,
8282
claCheck,
83-
changelogCheck,
8483
codeOwnerCheck,
8584
branchCheck,
8685
jobCheck,
@@ -92,14 +91,13 @@ const checksWhitelist = {
9291
[reopenEventGithubActions]: [claCheckGithubAction, wipCheck],
9392
[editEventGithubActions]: [wipCheck],
9493
[reopenEvent]: [
95-
changelogCheck,
9694
branchCheck,
9795
jobCheck,
9896
cronJobCheck,
9997
modelCheck,
10098
prTemplateCheck
10199
],
102-
[PRLabelEvent]: [assigneeCheck, prLabelCheck, hotfixLabelCheck],
100+
[PRLabelEvent]: [prLabelCheck, hotfixLabelCheck],
103101
[synchronizeEvent]: [
104102
mergeConflictCheck,
105103
jobCheck,
@@ -157,7 +155,6 @@ module.exports.issueCommentCreatedEvent = issueCommentCreatedEvent;
157155
module.exports.periodicCheck = periodicCheck;
158156
module.exports.claCheck = claCheck;
159157
module.exports.claCheckGithubAction = claCheckGithubAction;
160-
module.exports.changelogCheck = changelogCheck;
161158
module.exports.branchCheck = branchCheck;
162159
module.exports.wipCheck = wipCheck;
163160
module.exports.assigneeCheck = assigneeCheck;

images/docs/account_permissions.png

121 KB
Loading

images/docs/events.png

222 KB
Loading
184 KB
Loading

0 commit comments

Comments
 (0)