Skip to content

Commit

Permalink
Setup Github Actions (#69)
Browse files Browse the repository at this point in the history
* ignore editor folder

* move check issue labels to oppiabot

* build actions

* split up the pr

* create actions build test file and setup ci for it

* modify CI config

* update dist

* setup hooks

* testing hooks

* testing hooks

* build only when actions file changes

* testing hooks

* remove test comment

* modify lint-staged

* another test

* another test

* still testing

* final testing

* remove actions build test from ci

* address review comments

* address review comments

* Add branding icon and color

* setup branding and remove CI
  • Loading branch information
jameesjohn authored Jun 12, 2020
1 parent f59f724 commit d324e27
Show file tree
Hide file tree
Showing 7 changed files with 26,785 additions and 113 deletions.
15 changes: 15 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Oppiabot

description: Handles user interactions with issues.
branding:
color: purple
icon: activity

inputs:
repo-token: # Repository token.
description: 'The repository token needed to create comments.'
required: true

runs:
using: "node12"
main: "dist/index.js"
25 changes: 25 additions & 0 deletions actions/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2020 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Automatically compile github actions when
* actions related file changes.
*/

const { execSync } = require('child_process');

// Build the actions file.
execSync('npm run actions-build');
// Automatically add the build file to the commit index.
execSync('git add dist/index.js');
26 changes: 26 additions & 0 deletions actions/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2020 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Entry point of oppiabot github actions.
*/

const core = require('@actions/core');
const { context } = require('@actions/github');
const dispatcher = require('./src/dispatcher');

core.info(
`About to dispatch:${context.eventName} and ${context.payload.action}.`
);
dispatcher.dispatch(context.eventName, context.payload.action);
31 changes: 31 additions & 0 deletions actions/src/dispatcher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2020 The Oppia Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
* @fileoverview Handles dispatching events and actions to different handlers.
*/

const core = require('@actions/core');

const EVENTS = {
ISSUES: 'issues',
};
const ACTIONS = {
LABELLED: 'labeled'
};
module.exports = {
async dispatch(event, action) {
core.info(`Received Event:${event} Action:${action}.`);
}
};
Loading

0 comments on commit d324e27

Please sign in to comment.