mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-06-09 08:36:52 -04:00
Configure contributor check for github actions
This commit is contained in:
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
contributors:
|
||||
@@ -8,18 +8,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
||||
# Set these so we can run git commands
|
||||
- run: git config --global user.name "Mona Lisa"
|
||||
- run: git config --global user.email "email@example.com"
|
||||
- name: Install ruby version specified in .ruby-version
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
bundler-cache: true
|
||||
- name: Install ruby dependencies
|
||||
run: |
|
||||
sudo apt-get -yqq install libpq-dev build-essential libcurl4-openssl-dev
|
||||
gem install bundler
|
||||
bundle install --jobs 4 --retry 3
|
||||
- name: Check contributors
|
||||
run: |
|
||||
bundle exec script/check_contributors_md.rb
|
||||
./script/check_contributors_md.rb
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
|
||||
require "English"
|
||||
|
||||
puts "Checking to see if you're in CONTRIBUTORS.md..."
|
||||
if ENV['CI']
|
||||
if ENV['GITHUB_EVENT_NAME'] == 'pull_request'
|
||||
author = ENV['GITHUB_ACTOR']
|
||||
exit 1 unless author
|
||||
|
||||
if ENV['TRAVIS']
|
||||
if ENV['TRAVIS_PULL_REQUEST']
|
||||
elsif ENV['TRAVIS_PULL_REQUEST']
|
||||
require 'httparty'
|
||||
repo = ENV['TRAVIS_REPO_SLUG']
|
||||
pr = ENV['TRAVIS_PULL_REQUEST']
|
||||
@@ -15,7 +17,7 @@ if ENV['TRAVIS']
|
||||
author = response['user']['login'] if response && response['user']
|
||||
|
||||
# Could not determine author
|
||||
exit unless author
|
||||
exit 1 unless author
|
||||
else
|
||||
# We're in a Travis branch build; nothing to check
|
||||
exit
|
||||
@@ -34,6 +36,8 @@ end
|
||||
# Escape chars in name, and make case insensitive
|
||||
author_to_search_for = Regexp.new(Regexp.escape(author), Regexp::IGNORECASE)
|
||||
|
||||
puts("Checking for #{author} in CONTRIBUTORS.md")
|
||||
|
||||
unless File.read('CONTRIBUTORS.md').match?(author_to_search_for)
|
||||
abort %(
|
||||
Thanks for your contribution, #{author}!
|
||||
|
||||
Reference in New Issue
Block a user