From 891990841c696523f7ff880d71909b6cc6b7540f Mon Sep 17 00:00:00 2001 From: Jack Weeden Date: Tue, 14 Jan 2025 09:50:59 +0000 Subject: [PATCH] Extend Rubocop workflow to allow setting of Github token This allows workflows which call this reusable workflow to optionally set a `BUNDLER_GITHUB_TOKEN` secret. Setting a value for this token will set a `BUNDLE_GITHUB__COM` environment variable in the `setup-ruby` step. This env var is an authentication string which Bundler will use when attempting to install gems from private repositories on Github. Note: omitting this secret when calling the workflow has no effect on installing gems from Rubygems, or public gems from Github. It only takes effect when installing gems from a private Github repo. --- .github/workflows/rubocop.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 6a226920a..c37a48635 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -2,6 +2,10 @@ name: Run RuboCop on: workflow_call: + secrets: + BUNDLER_GITHUB_TOKEN: + required: false + description: "Token used for Bundler to authenticate when installing gems from private Github repos" jobs: run-rubocop: @@ -16,6 +20,8 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true + env: + BUNDLE_GITHUB__COM: "x-access-token:${{ secrets.BUNDLER_GITHUB_TOKEN }}" - name: Run RuboCop run: bundle exec rubocop --parallel --format github --format progress