Skip to content

Commit

Permalink
Merge branch 'master' into no-auth
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasalbarello authored Jun 19, 2022
2 parents 8c77e11 + 8ac0597 commit e39ef90
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

gem "octokit", "~> 4.20"
gem "octokit", "~> 4.23"
gem "activesupport", "~> 6.1.1"

group :test, :development do
Expand Down
26 changes: 12 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ GEM
byebug (11.1.3)
concurrent-ruby (1.1.7)
diff-lcs (1.4.4)
faraday (1.3.0)
faraday-net_http (~> 1.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords
faraday-net_http (1.0.1)
faraday (2.3.0)
faraday-net_http (~> 2.0)
ruby2_keywords (>= 0.0.4)
faraday-net_http (2.0.3)
i18n (1.8.7)
concurrent-ruby (~> 1.0)
minitest (5.14.3)
multipart-post (2.1.1)
octokit (4.20.0)
faraday (>= 0.9)
sawyer (~> 0.8.0, >= 0.5.3)
octokit (4.23.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
parallel (1.20.1)
parser (3.0.2.0)
ast (~> 2.4.1)
public_suffix (4.0.6)
public_suffix (4.0.7)
rainbow (3.0.0)
regexp_parser (2.1.1)
rexml (3.2.5)
Expand Down Expand Up @@ -60,10 +58,10 @@ GEM
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.2)
sawyer (0.8.2)
ruby2_keywords (0.0.5)
sawyer (0.9.1)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
faraday (>= 0.17.3, < 3)
standard (1.1.7)
rubocop (= 1.18.4)
rubocop-performance (= 1.11.4)
Expand All @@ -79,7 +77,7 @@ PLATFORMS
DEPENDENCIES
activesupport (~> 6.1.1)
byebug
octokit (~> 4.20)
octokit (~> 4.23)
rspec
standard

Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ jobs:
allowed-conclusions: success,skipped,cancelled
...
```

### Using check-regexp
Similar to the `check-name` parameter, this filters the checks to be waited but using a Regular Expression (aka regexp) to match the check name (jobs.<job_id>.name)

Expand Down Expand Up @@ -252,6 +251,12 @@ jobs:
### Verbose (optional, default: true)
If true, it prints some logs to help understanding the process (checks found, filtered, conclussions, etc.)

## Auto-pagination

Since we are using Octokit for using GitHub API, we are subject to their limitations. One of them is the pagination max size: if we have more than 100 workflows running, the auto-pagination won't help.
More about Octokit auto-pagination can be found [here](https://octokit.github.io/octokit.rb/file.README.html#Pagination:~:text=get.data-,Auto%20Pagination,-For%20smallish%20resource)
The solution would be to fetch all pages to gather all running workflows if they're more than 100, but it's still no implemented.

## Tests

There are sample workflows in the `.github/workflows` directory. Two of them are logging tasks to emulate real-world actions being executed that have to be waited. The important workflows are the ones that use the wait-on-check-action.
Expand Down
2 changes: 1 addition & 1 deletion app/services/github_checks_verifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def call

def query_check_status
checks = client.check_runs_for_ref(
repo, ref, {per_page: 100, accept: "application/vnd.github.antiope-preview+json"}
repo, ref, {accept: "application/vnd.github.antiope-preview+json"}
).check_runs
log_checks(checks, "Checks running on ref:")

Expand Down
6 changes: 2 additions & 4 deletions entrypoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@
config.allowed_conclusions = allowed_conclusions.split(",").map(&:strip)
config.check_name = check_name
config.check_regexp = check_regexp
config.client = Octokit::Client.new
unless token.empty?
config.client.access_token = token
end
config.client = Octokit::Client.new(auto_paginate: true)
config.client.access_token = token unless token.empty?
config.ref = ref
config.repo = ENV["GITHUB_REPOSITORY"]
config.verbose = verbose
Expand Down

0 comments on commit e39ef90

Please sign in to comment.