diff --git a/README.md b/README.md index 460481a..bdc01f0 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,29 @@ jobs: ... ``` +## GHE Support + +For GHE support you just need to pass in `api-endpoint` as an input. + +```yml +name: Publish + +on: [push] + +jobs: + publish: + name: Publish the package + runs-on: ubuntu-latest + steps: + - name: Wait for tests to succeed + uses: lewagon/wait-on-check-action@v1.0.0 + with: + ref: ${{ github.ref }} + check-name: 'Run tests' + repo-token: ${{ secrets.GITHUB_TOKEN }} + api-endpoint: YOUR_GHE_API_BASE_URL # Fed to https://octokit.github.io/octokit.rb/Octokit/Configurable.html#api_endpoint-instance_method + ... +``` ## Alternatives If you can keep the dependent jobs in a single workflow: diff --git a/action.yml b/action.yml index b5333e2..d782063 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,10 @@ inputs: description: "Seconds to wait between Checks API requests" required: false default: "10" + api-endpoint: + description: "Github API Endpoint to use." + required: false + default: "" running-workflow-name: description: "Name of the workflow to be ignored (the one who is waiting for the rest)" required: false @@ -68,6 +72,7 @@ runs: VERBOSE: ${{ inputs.verbose }} WAIT_INTERVAL: ${{ inputs.wait-interval }} RUNNING_WORKFLOW_NAME: ${{ inputs.running-workflow-name }} + API_ENDPOINT: ${{ inputs.api-endpoint }} branding: icon: "check-circle" color: "green" diff --git a/app/errors/check_conclusion_not_allowed_error.rb b/app/errors/check_conclusion_not_allowed_error.rb index b471cdf..1462d34 100644 --- a/app/errors/check_conclusion_not_allowed_error.rb +++ b/app/errors/check_conclusion_not_allowed_error.rb @@ -2,7 +2,7 @@ class CheckConclusionNotAllowedError < StandardError def initialize(allowed_conclusions) - msg = "The conclusion of one or more checks were not allowed. Allowed conclusions are: "\ + msg = "The conclusion of one or more checks were not allowed. Allowed conclusions are: " \ "#{allowed_conclusions.join(", ")}. This can be configured with the 'allowed-conclusions' param." super(msg) end diff --git a/app/services/application_service.rb b/app/services/application_service.rb index 44262b0..48c328e 100644 --- a/app/services/application_service.rb +++ b/app/services/application_service.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true class ApplicationService - def self.call(*args, &block) - new(*args, &block).call + def self.call(...) + new(...).call end end diff --git a/app/spec/services/github_checks_verifier_spec.rb b/app/spec/services/github_checks_verifier_spec.rb index 7b81618..5037b31 100644 --- a/app/spec/services/github_checks_verifier_spec.rb +++ b/app/spec/services/github_checks_verifier_spec.rb @@ -98,7 +98,7 @@ ] allow(service).to receive(:query_check_status).and_return all_checks - expected_msg = "The conclusion of one or more checks were not allowed. Allowed conclusions are: "\ + expected_msg = "The conclusion of one or more checks were not allowed. Allowed conclusions are: " \ "success, skipped. This can be configured with the 'allowed-conclusions' param." expect { service.call diff --git a/entrypoint.rb b/entrypoint.rb index fb28b2f..1793097 100755 --- a/entrypoint.rb +++ b/entrypoint.rb @@ -10,13 +10,15 @@ verbose = ENV["VERBOSE"] wait = ENV["WAIT_INTERVAL"] workflow_name = ENV["RUNNING_WORKFLOW_NAME"] +api_endpoint = ENV.fetch("API_ENDPOINT", "") GithubChecksVerifier.configure do |config| config.allowed_conclusions = allowed_conclusions.split(",").map(&:strip) config.check_name = check_name config.check_regexp = check_regexp config.client = Octokit::Client.new(auto_paginate: true) - config.client.access_token = token unless token.empty? + config.client.api_endpoint = api_endpoint unless /\A[[:space:]]*\z/.match?(api_endpoint) + config.client.access_token = token config.ref = ref config.repo = ENV["GITHUB_REPOSITORY"] config.verbose = verbose