diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aadb8b3..63166a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,8 +10,10 @@ on: jobs: ci: - name: 'Ruby ${{ matrix.ruby_version }}' - runs-on: '${{ matrix.os }}' + name: 'Ruby: ${{ matrix.ruby_version }} • Faraday: ~> ${{ matrix.faraday_version }}' + runs-on: ${{ matrix.os }} + env: + FARADAY_VERSION: ${{ matrix.faraday_version }} strategy: fail-fast: false matrix: @@ -20,6 +22,9 @@ jobs: - '3.0' - '3.1' - '3.2' + faraday_version: + - '1.0' + - '2.0' os: - ubuntu-latest steps: diff --git a/lib/jekyll-github-metadata/client.rb b/lib/jekyll-github-metadata/client.rb index 17fc6fc..f655152 100644 --- a/lib/jekyll-github-metadata/client.rb +++ b/lib/jekyll-github-metadata/client.rb @@ -68,14 +68,20 @@ def method_missing(method_name, *args, &block) end end - # NOTE: Faraday's error classes has been promoted to under Faraday module from v1.0.0. - # This patch aims to prevent on locking specific version of Faraday. + # NOTE: Faraday's error classes have been simplified from v1.0.0. + # + # In older versions, both `Faraday::Error::ConnectionFailed` and `Faraday::ConnectionFailed` + # were valid and equivalent to each other. + # From v1.0.0 onwards, `Faraday::Error::ConnectionFailed` no longer exists. + # + # TODO: Remove in v2.0 of this plugin. FARADAY_FAILED_CONNECTION = begin Faraday::Error::ConnectionFailed rescue NameError Faraday::ConnectionFailed end + deprecate_constant :FARADAY_FAILED_CONNECTION def save_from_errors(default = false) unless internet_connected? @@ -86,7 +92,7 @@ def save_from_errors(default = false) yield @client rescue Octokit::Unauthorized raise BadCredentialsError, "The GitHub API credentials you provided aren't valid." - rescue FARADAY_FAILED_CONNECTION, Octokit::TooManyRequests => e + rescue Faraday::ConnectionFailed, Octokit::TooManyRequests => e GitHubMetadata.log :warn, e.message default rescue Octokit::NotFound