GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add token input for downloading release assets by TingluoHuang · Pull Request #851 · ruby/setup-ruby

Add token input for downloading release assets #851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
eregon merged 3 commits into ruby:master from TingluoHuang:master
Jan 7, 2026

Uh oh!

There was an error while loading. Please reload this page.

Merged

Add token input for downloading release assets #851

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
7c51083
Add token input and pass it to release assets download.
TingluoHuang Jan 6, 2026
6ceff95
Tweaks
eregon Jan 7, 2026
a42e0d6
Define a helper to download to avoid duplication
eregon Jan 7, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

17 changes: 17 additions & 0 deletions 17 README.md
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,23 @@ and the [condition and expression syntax](https://help.github.com/en/actions/ref
The `working-directory` input can be set to resolve `.ruby-version`, `.tool-versions`, `mise.toml` and `Gemfile.lock`
if they are not at the root of the repository, see [action.yml](action.yml) for details.

### Authentication Token

By default, this action uses `${{ github.token }}` to authenticate when downloading Ruby release assets from GitHub.
This helps avoid rate limiting issues.

If you're running this action on a GitHub Enterprise Server (GHES) instance, or if you're experiencing rate limiting,
you can provide a custom token:

```yaml
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
token: ${{ secrets.MY_GITHUB_TOKEN }}
```

In most cases, you don't need to set this input as the default value is sufficient for use on github.com.
Comment thread Outdated

@eregon eregon Jan 7, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll move this section further as the input is expected to be very rarely set.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

TingluoHuang reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

### RubyGems

By default, the default RubyGems version that comes with each Ruby is used.
Expand Down
7 changes: 7 additions & 0 deletions 7 action.yml
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ inputs:
It also sets environment variables using 'ridk' or 'vcvars64.bat' based on the selected Ruby.
At present, the only other setting than 'default' is 'none', which only adds Ruby to PATH.
No build tools or packages are installed, nor are any ENV setting changed to activate them.
token:
description: |
Used to authenticate with GitHub when downloading Ruby release assets.
Since there is a default, this is typically not supplied by the user.
When running this action on github.com, the default value is sufficient.
When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
Comment thread
Comment on lines +47 to +52

@eregon eregon Jan 7, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @MSP-Greg it's probably best you modify https://github.com/ruby/setup-ruby-pkgs/blob/main/action.yml similarly, because the default here needs to be expressed directly in action.yml.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MSP-Greg reacted with eyes emoji
All reactions
  • 👀 1 reaction

outputs:
ruby-prefix:
Expand Down
3 changes: 2 additions & 1 deletion 3 common.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export const drive = (windows ? (process.env['RUNNER_TEMP'] || 'C')[0] : undefin
const PATH_ENV_VAR = windows ? 'Path' : 'PATH'

export const inputs = {
selfHosted: undefined
selfHosted: undefined,
token: undefined
}

export function partition(string, separator) {
Expand Down
20 changes: 14 additions & 6 deletions 20 dist/index.js
Show comments
View file
Open in desktop

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Oops, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

2 changes: 2 additions & 0 deletions 2 index.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const inputDefaults = {
'cache-version': bundler.DEFAULT_CACHE_VERSION,
'self-hosted': 'false',
'windows-toolchain': 'default',
'token': '',
}

// entry point when this action is run on its own
Expand Down Expand Up @@ -45,6 +46,7 @@ export async function setupRuby(options = {}) {
}
}
common.inputs.selfHosted = inputs['self-hosted']
common.inputs.token = inputs['token']

process.chdir(inputs['working-directory'])

Expand Down
3 changes: 2 additions & 1 deletion 3 ruby-builder.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ async function downloadAndExtract(platform, engine, version, rubyPrefix) {
const downloadPath = await common.measure('Downloading Ruby', async () => {
const url = getDownloadURL(platform, engine, version)
console.log(url)
const auth = common.inputs.token ? `token ${common.inputs.token}` : undefined
try {
return await tc.downloadTool(url)
return await tc.downloadTool(url, undefined, auth)
} catch (error) {
if (error.message.includes('404')) {
throw new Error(`Unavailable version ${version} for ${engine} on ${platform}
Expand Down
12 changes: 8 additions & 4 deletions 12 windows.js
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ export async function install(platform, engine, version) {
async function downloadAndExtract(engine, version, url, base, rubyPrefix) {
const downloadPath = await common.measure('Downloading Ruby', async () => {
console.log(url)
return await tc.downloadTool(url)
const auth = common.inputs.token ? `token ${common.inputs.token}` : undefined
return await tc.downloadTool(url, undefined, auth)
})

const extractPath = process.env.RUNNER_TEMP
Expand Down Expand Up @@ -113,7 +114,8 @@ export async function installJRubyTools() {
async function installMSYS2(url, rubyPrefix = process.env.RUNNER_TEMP) {
const downloadPath = await common.measure('Downloading msys2 build tools', async () => {
console.log(url)
return await tc.downloadTool(url)
const auth = common.inputs.token ? `token ${common.inputs.token}` : undefined
return await tc.downloadTool(url, undefined, auth)
})

const extractPath = path.join(process.env.RUNNER_TEMP, 'msys64')
Expand Down Expand Up @@ -160,7 +162,8 @@ async function installMSYS1(url) {

const downloadPath = await common.measure('Downloading msys1 build tools', async () => {
console.log(url)
return await tc.downloadTool(url)
const auth = common.inputs.token ? `token ${common.inputs.token}` : undefined
return await tc.downloadTool(url, undefined, auth)
})

const msys1Path = `${common.drive}:\\DevKit64`
Expand Down Expand Up @@ -196,7 +199,8 @@ async function installMSYS1(url) {
async function installVCPKG(url) {
const downloadPath = await common.measure('Downloading mswin vcpkg packages', async () => {
console.log(url)
return await tc.downloadTool(url)
const auth = common.inputs.token ? `token ${common.inputs.token}` : undefined
return await tc.downloadTool(url, undefined, auth)
})

const extractPath = process.env.VCPKG_INSTALLATION_ROOT
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.