Skip to content

fix: pass the GitHub token as a build secret, resolve static-php-cli tag without GitHub API - #14

Merged
rfay merged 1 commit into
mainfrom
20261016_stasadev_github_token_secret
Oct 18, 2026
Merged

rfay merged 1 commit into
mainfrom
20261016_stasadev_github_token_secret

Conversation

@stasadev

Copy link
Copy Markdown
Collaborator

The Issue

The latest static-php-cli tag came from api.github.com, which allows 60 unauthenticated requests per hour per IP. The token was passed as a build arg, which is recorded in docker history and in .ddev/.ddev-docker-compose-full.yaml.

How This PR Solves The Issue

Manual Testing Instructions

ddev utility download-ddev --pr 8948
export PATH="$HOME/tmp/ddev-download-ddev/pr-8948:$PATH"
ddev config --project-type=php
ddev dotenv set .ddev/.env.php-patch-build --static-php-version=8.3.19
ddev add-on get https://github.com/rfay/ddev-php-patch-build/tarball/refs/pull/14/head
ddev restart
ddev php -v
# A bogus token must reach static-php-cli and fail the build:
DDEV_GITHUB_TOKEN=ghp_bogus ddev utility rebuild
# Expect "using bearer github token" followed by "curl: (22) The requested URL returned error: 401"

Automated Testing Overview

No new tests. The HEAD job passes the action's token through the secret. The stable job builds without a token until ddev/ddev#8948 is in a DDEV release.

Release/Deployment Notes

With DDEV v1.25.4 and older, the token is no longer passed to the build.

…tag without GitHub API (#14)

## The Issue

- Related to ddev/ddev-nvm#6
- Follow-up to ddev/ddev-sqlsrv#57

The latest static-php-cli tag came from `api.github.com`, which allows 60 unauthenticated requests per hour per IP. The token was passed as a build arg, which is recorded in `docker history` and in `.ddev/.ddev-docker-compose-full.yaml`.

## How This PR Solves The Issue

- Read the tag from the `https://github.com/crazywhalecc/static-php-cli/releases/latest` redirect, which is not API rate-limited, and check that it looks like a version
- Remove the `GITHUB_TOKEN` build arg and mount the `github_token` build secret that DDEV provides since ddev/ddev#8948
- Export the secret as `GITHUB_TOKEN` for `bin/spc download`. `composer update` doesn't need it, because Composer downloads from GitHub don't count against the API rate limit

## Manual Testing Instructions

```bash
ddev utility download-ddev --pr 8948
export PATH="$HOME/tmp/ddev-download-ddev/pr-8948:$PATH"
ddev config --project-type=php
ddev dotenv set .ddev/.env.php-patch-build --static-php-version=8.3.19
ddev add-on get https://github.com/rfay/ddev-php-patch-build/tarball/refs/pull/14/head
ddev restart
ddev php -v
# A bogus token must reach static-php-cli and fail the build:
DDEV_GITHUB_TOKEN=ghp_bogus ddev utility rebuild
# Expect "using bearer github token" followed by "curl: (22) The requested URL returned error: 401"
```

## Automated Testing Overview

No new tests. The `HEAD` job passes the action's token through the secret. The `stable` job builds without a token until ddev/ddev#8948 is in a DDEV release.

## Release/Deployment Notes

With DDEV v1.25.4 and older, the token is no longer passed to the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rfay

rfay commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thanks!

@rfay
rfay merged commit 8f8ae73 into main Oct 18, 2026
2 checks passed
@rfay
rfay deleted the 20261016_stasadev_github_token_secret branch October 18, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants