setup-php 2.35.2 → 2.35.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -465,6 +465,7 @@ Disable coverage for these reasons:
465
465
  - Specify the GitHub token to use for authentication.
466
466
  - Accepts a `string`.
467
467
  - By default, `GITHUB_TOKEN` secret provided by GitHub Actions is used.
468
+ - For GitHub Enterprise users, it is recommended to use a Personal Access Token (PAT).
468
469
 
469
470
  ### Outputs
470
471
 
@@ -797,8 +798,6 @@ restore-keys: ${{ runner.os }}-composer-${{ matrix.prefer }}-
797
798
 
798
799
  By default, setup-php uses the `GITHUB_TOKEN` secret that is generated for each workflow run. In case you want to use a Personal Access Token (PAT) instead, you can set the `github-token` input.
799
800
 
800
- The `COMPOSER_TOKEN` and `GITHUB_TOKEN` environment variables have been deprecated in favor of the `github-token` input and will be removed in the next major version.
801
-
802
801
  ```yaml
803
802
  - name: Setup PHP
804
803
  uses: shivammathur/setup-php@v2
@@ -807,6 +806,10 @@ The `COMPOSER_TOKEN` and `GITHUB_TOKEN` environment variables have been deprecat
807
806
  github-token: ${{ secrets.YOUR_PAT_TOKEN }}
808
807
  ```
809
808
 
809
+ The `COMPOSER_TOKEN` and `GITHUB_TOKEN` environment variables have been deprecated in favor of the `github-token` input and will be removed in the next major version.
810
+
811
+ For GitHub Enterprise users, the `github-token` input does not default to the `GITHUB_TOKEN` secret. Therefore, it's recommended to set the `github-token` input to a Personal Access Token (PAT).
812
+
810
813
  ### Private Packagist Authentication
811
814
 
812
815
  If you use Private Packagist for your private composer dependencies, you can set the `PACKAGIST_TOKEN` environment variable to authenticate.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setup-php",
3
- "version": "2.35.2",
3
+ "version": "2.35.3",
4
4
  "private": false,
5
5
  "description": "Setup PHP for use with GitHub Actions",
6
6
  "main": "lib/install.js",
@@ -40,26 +40,26 @@
40
40
  "compare-versions": "^6.1.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@eslint/compat": "^1.3.1",
44
- "@eslint/js": "9.32.0",
43
+ "@eslint/compat": "^1.3.2",
44
+ "@eslint/js": "9.33.0",
45
45
  "@types/jest": "^30.0.0",
46
- "@types/node": "^24.1.0",
47
- "@typescript-eslint/eslint-plugin": "^8.38.0",
48
- "@typescript-eslint/parser": "^8.38.0",
46
+ "@types/node": "^24.2.1",
47
+ "@typescript-eslint/eslint-plugin": "^8.39.0",
48
+ "@typescript-eslint/parser": "^8.39.0",
49
49
  "@vercel/ncc": "^0.38.3",
50
- "eslint": "9.32.0",
50
+ "eslint": "9.33.0",
51
51
  "eslint-config-prettier": "^10.1.8",
52
52
  "eslint-plugin-import": "^2.32.0",
53
53
  "eslint-plugin-jest": "^29.0.1",
54
- "eslint-plugin-prettier": "^5.5.3",
54
+ "eslint-plugin-prettier": "^5.5.4",
55
55
  "globals": "^16.3.0",
56
56
  "jest": "^30.0.5",
57
57
  "jest-circus": "^30.0.5",
58
- "nock": "^14.0.7",
58
+ "nock": "^14.0.9",
59
59
  "prettier": "^3.6.2",
60
- "simple-git-hooks": "^2.13.0",
61
- "ts-jest": "^29.4.0",
62
- "typescript": "^5.8.3"
60
+ "simple-git-hooks": "^2.13.1",
61
+ "ts-jest": "^29.4.1",
62
+ "typescript": "^5.9.2"
63
63
  },
64
64
  "overrides": {
65
65
  "test-exclude": "^7.0.1"
@@ -48,6 +48,19 @@ change_library_paths() {
48
48
  fi
49
49
  }
50
50
 
51
+ # Add hiredis library
52
+ add_hiredis_1.1.0() {
53
+ hiredis_url=https://github.com/redis/hiredis/archive/v1.1.0.tar.gz
54
+ hiredis_sha=fe6d21741ec7f3fc9df409d921f47dfc73a4d8ff64f4ac6f1d95f951bf7f53d6
55
+ sed -Ei.bak -e "s#^ url.*# url \"$hiredis_url\"#" -e "s#^ sha256.*# sha256 \"$hiredis_sha\"#" ${core_repo:?}/Formula/h/hiredis.rb
56
+ brew install -s hiredis
57
+ lib_dir="${brew_prefix:?}"/opt/hiredis/lib
58
+ if [ -e "$lib_dir"/libhiredis_ssl.1.1.0.dylib ]; then
59
+ sudo ln -sf "$lib_dir"/libhiredis_ssl.1.1.0.dylib "$lib_dir"/libhiredis_ssl.dylib.1.1.0
60
+ fi
61
+ mv ${core_repo:?}/Formula/h/hiredis.rb.bak ${core_repo:?}/Formula/h/hiredis.rb
62
+ }
63
+
51
64
  # Add relay dependencies
52
65
  add_relay_dependencies() {
53
66
  add_extension json
@@ -56,7 +69,12 @@ add_relay_dependencies() {
56
69
  if [ "$os" = "Darwin" ]; then
57
70
  . "${0%/*}"/tools/brew.sh
58
71
  configure_brew
59
- brew install lz4 hiredis zstd concurrencykit
72
+ if [ "$relay_version" = "v0.7.0" ]; then
73
+ brew install lz4 zstd concurrencykit
74
+ add_hiredis_1.1.0 >/dev/null 2>&1
75
+ else
76
+ brew install lz4 hiredis zstd concurrencykit
77
+ fi
60
78
  fi
61
79
  }
62
80
 
@@ -61,6 +61,19 @@ Function Update-AuthJson {
61
61
  Set-Content -Path $composer_home\auth.json -Value ($existing | ConvertTo-Json -Depth 5)
62
62
  }
63
63
 
64
+ function Test-GitHubPublicAccess {
65
+ param(
66
+ [Parameter(Mandatory=$true)]
67
+ [string]$Token
68
+ )
69
+ try {
70
+ Invoke-RestMethod -Uri 'https://api.github.com/' -Headers @{ Authorization = "token $Token" } -ErrorAction Stop | Out-Null
71
+ return $true
72
+ } catch {
73
+ return $false
74
+ }
75
+ }
76
+
64
77
  # Function to setup authentication in composer.
65
78
  Function Set-ComposerAuth() {
66
79
  if(Test-Path env:COMPOSER_AUTH_JSON) {
@@ -74,11 +87,15 @@ Function Set-ComposerAuth() {
74
87
  if(Test-Path env:PACKAGIST_TOKEN) {
75
88
  $composer_auth += '"http-basic": {"repo.packagist.com": { "username": "token", "password": "' + $env:PACKAGIST_TOKEN + '"}}'
76
89
  }
77
- if(-not(Test-Path env:GITHUB_TOKEN) -and (Test-Path env:COMPOSER_TOKEN)) {
78
- $env:GITHUB_TOKEN = $env:COMPOSER_TOKEN
79
- }
80
- if (Test-Path env:GITHUB_TOKEN) {
81
- $composer_auth += '"github-oauth": {"github.com": "' + $env:GITHUB_TOKEN + '"}'
90
+ $write_token = $true
91
+ $token = if ($env:COMPOSER_TOKEN) { $env:COMPOSER_TOKEN } else { $env:GITHUB_TOKEN }
92
+ if ($token) {
93
+ if ($env:GITHUB_SERVER_URL -ne "https://github.com" -and -not(Test-GitHubPublicAccess $token)) {
94
+ $write_token = $false
95
+ }
96
+ if($write_token) {
97
+ $composer_auth += '"github-oauth": {"github.com": "' + $token + '"}'
98
+ }
82
99
  }
83
100
  if($composer_auth.length) {
84
101
  Update-AuthJson $composer_auth
@@ -65,6 +65,11 @@ update_auth_json() {
65
65
  printf '%s' "$merged" > "$composer_home/auth.json"
66
66
  }
67
67
 
68
+ # Function to check if public GitHub token authentication is possible.
69
+ can_access_public_github() {
70
+ curl --fail -s -H "Authorization: token $1" 'https://api.github.com/' >/dev/null 2>&1
71
+ }
72
+
68
73
  # Function to setup authentication in composer.
69
74
  set_composer_auth() {
70
75
  if [ -n "$COMPOSER_AUTH_JSON" ]; then
@@ -78,8 +83,15 @@ set_composer_auth() {
78
83
  if [ -n "$PACKAGIST_TOKEN" ]; then
79
84
  composer_auth+=( '"http-basic": {"repo.packagist.com": { "username": "token", "password": "'"$PACKAGIST_TOKEN"'"}}' )
80
85
  fi
81
- if [ -n "${GITHUB_TOKEN:-$COMPOSER_TOKEN}" ]; then
82
- composer_auth+=( '"github-oauth": {"github.com": "'"${GITHUB_TOKEN:-$COMPOSER_TOKEN}"'"}' )
86
+ token="${COMPOSER_TOKEN:-$GITHUB_TOKEN}"
87
+ if [ -n "$token" ]; then
88
+ write_token=true
89
+ if [ "$GITHUB_SERVER_URL" != "https://github.com" ]; then
90
+ can_access_public_github "$token" || write_token=false
91
+ fi
92
+ if [ "$write_token" = 'true' ]; then
93
+ composer_auth+=( '"github-oauth": {"github.com": "'"$token"'"}' )
94
+ fi
83
95
  fi
84
96
  if ((${#composer_auth[@]})); then
85
97
  update_auth_json "${composer_auth[@]}"