diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dbc067fa6..16fe06cc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/script/check_contributors_md.rb b/script/check_contributors_md.rb index d0013e78c..317c73fe6 100755 --- a/script/check_contributors_md.rb +++ b/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}!