Skip to content

Commit

Permalink
Extend Ruby workflows to allow setting of Github token
Browse files Browse the repository at this point in the history
This allows workflows which call these 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 8b41d67 commit c20905a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/brakeman.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Run Brakeman

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-brakeman:
Expand All @@ -19,6 +23,8 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
env:
BUNDLE_GITHUB__COM: "x-access-token:${{ secrets.BUNDLER_GITHUB_TOKEN }}"

- name: Run Brakeman
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/erblint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ name: Run Erb Lint

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-erblint:
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 ErbLint
run: bundle exec erblint --lint-all
6 changes: 6 additions & 0 deletions .github/workflows/jasmine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
required: false
default: false
type: boolean
secrets:
BUNDLER_GITHUB_TOKEN:
required: false
description: "Token used for Bundler to authenticate when installing gems from private Github repos"

jobs:
run-jasmine:
Expand All @@ -24,6 +28,8 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
env:
BUNDLE_GITHUB__COM: "x-access-token:${{ secrets.BUNDLER_GITHUB_TOKEN }}"

- name: Setup Node
uses: alphagov/govuk-infrastructure/.github/actions/setup-node@main
Expand Down

0 comments on commit c20905a

Please sign in to comment.