Myoldmopar / decent_ci

0 stars 0 forks source link

Fix commit message lookup #47

Closed Myoldmopar closed 3 years ago

Myoldmopar commented 3 years ago

Tested this in a standalone project and verified it finds the commit message now, so Decent should skip it.

require 'octokit'

token = File.read("/home/edwin/Documents/token").strip!
@client = Octokit::Client.new(:access_token => token)
branches = %w[develop conv-coeff-enums-2 TestSkipDecent auto-window-mult]
branches.each do |b|
  branch_details = @client.branch('NREL/EnergyPlus', b)
  skip_message_present = false
  begin
    skip_message_present = branch_details.commit.commit.message['[decent_ci_skip]']
    puts "Skipping branch #{b}" if skip_message_present
  rescue
    # ignore
  end
  next if skip_message_present && b != 'develop'
  puts "Working on branch #{b}"
end 

prints:

Working on branch develop
Working on branch conv-coeff-enums-2
Skipping branch TestSkipDecent
Working on branch auto-window-mult

Which is correct, because the TestSkipDecent branch has [decent_ci_skip] in the commit message. Decent will also always run for the develop branch.