Skip to content

urmot/errand_boy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ErrandBoy CircleCI

ErrandBoy is the admin support tool.

Description

ErrandBoy helps a administrator job. It executes the action when administrator merged pull request. If you want to request for slack invitation to administrator, all it takes is to write a request file and create pull request to the ErrandBoy repository. When the administrator merge pull request that allowed by him, ErrandBoy sends slack invitation mail instead of the administrator.

Installation

Add this line to your application's Gemfile:

gem 'errand-boy'

Add index/ and requests/:

$ mkdir ./index
$ mkdir ./requests
$ touch ./requests/.keep

Add bin/exe:

#!/usr/bin/env ruby

require 'bundler/setup'
require 'errand_boy'

ErrandBoy::Brain.new.command

Add circle.yml:

machine:
  timezone:
    Asia/Tokyo

  ruby:
    version:
      2.3.1

  post:
    - sudo service mysql stop
    - sudo service postgresql stop

dependencies:
  pre:
    - gem install bundler -v 1.11

  override:
    - bundle install

test:
  override:
    - echo "-----no test-----"

deployment:
  run:
    branch: /master|.*request.*/
    commands:
      - git config --global user.name errand-boy
      - git config --global user.email errandboy0.1.0@gmail.com
      - bin/exe

Setting

Slack

Get a slack access token from https://api.slack.com/web:

generate_test_tokens

Create access token:

create_token

CircleCI

Build CircleCI project from https://circleci.com/add-projects:

build_project

Registered a deploy key:

place: Project Settings >> Permissions >> Checkout SSH keys

authorize_w

Add slack access token to environment variable:

place: Project Setting >> Build Settings >> Environment Variables

environment_variable

Usage

Make and checkout a new branch that named including request (prefix):

$ git checkout -b new_request

Make a new request file in requests/ folder:

  • The file should be formatted by TOML.
$ vim requests/example.toml
# requests/example.toml

provider    = 'slack'  # Now slack only.
action      = 'invite' # Now invite only.
sender      = { name = 'tanaka taro', email = 'taro@example.com' } # Sender information.
# Register information. It is required information.
register  = { name = 'yamada hanako', email = 'hanako@example.com' }
destination = { team = 'example' } # It is team that the register will be invited.

Push a new request file and create a pull request:

  • Push a new request file
$ git add .
$ git commit -m 'request slack invite example'
$ git push -u origin new_request
  • Create a new pull request on your errand_boy repository.

Merge pull request by administrator:

ErrandBoy executes the action when the administrator merge pull request.

Confirm action histories

If you want to see invite histories, you can see index/***.csv on your errand_boy repository.

ENV

SLACK_ACCESS_TOKEN - You should set slack access token on CircleCI.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bm-sms/errand_boy.

License

The gem is available as open source under the terms of the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages