Skip to content

Commit

Permalink
Extend Rubocop workflow to allow setting of Github token
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jackbot committed Jan 14, 2025
1 parent 80e4ffa commit 8919908
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Run RuboCop

on:
workflow_call:
secrets:

Check failure on line 5 in .github/workflows/rubocop.yml

View workflow job for this annotation

GitHub Actions / actionlint

unknown Webhook event "secrets". see https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#webhook-events for list of all Webhook event names
BUNDLER_GITHUB_TOKEN:

Check failure on line 6 in .github/workflows/rubocop.yml

View workflow job for this annotation

GitHub Actions / actionlint

unexpected key "BUNDLER_GITHUB_TOKEN" for "secrets" section. expected one of "branches", "branches-ignore", "paths", "paths-ignore", "tags", "tags-ignore", "types", "workflows"
required: false
description: "Token used for Bundler to authenticate when installing gems from private Github repos"

jobs:
run-rubocop:
Expand All @@ -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

0 comments on commit 8919908

Please sign in to comment.