Checking GitHub Actions for updates spawns `git ls-remote` against every repository referenced by the workflow files. That reaches the network in a way pnpm cannot validate up front, and it fails wherever GitHub is not reachable the way pnpm assumes: a GitHub Enterprise Server hosting the actions (pnpm/pnpm#13220), a container with a custom certificate authority (pnpm/pnpm#13254), an offline or proxied CI network. Both reports came within days of the feature shipping, and neither is fixable from pnpm's side, so the check no longer runs unless it is asked for. `pnpm outdated` and `pnpm update` — interactive or not, recursive or not — now read workflow files only with `--include-github-actions` or with `update.githubActions` set to `true`. `update.githubActions: false` keeps working; it is now equivalent to leaving the setting unset, so anyone who added it to silence the warnings needs no change. The opt-in rule lives in one place per stack (`shouldCheckGitHubActions` and `github_actions::opted_in`) and is shared by every call site, so the commands cannot drift apart again. `pnpm outdated` gained the `--include-github-actions` flag it was missing. Closes pnpm/pnpm#13254
62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
import fs from 'node:fs'
|
|
import path from 'node:path'
|
|
|
|
import { beforeEach, expect, jest, test } from '@jest/globals'
|
|
import { prepare } from '@pnpm/prepare'
|
|
|
|
import { DEFAULT_OPTS } from '../utils/index.js'
|
|
|
|
const originalModule = await import('@pnpm/deps.github-actions')
|
|
jest.unstable_mockModule('@pnpm/deps.github-actions', () => {
|
|
return {
|
|
...originalModule,
|
|
findOutdatedGitHubActions: jest.fn(async () => []),
|
|
}
|
|
})
|
|
|
|
const { findOutdatedGitHubActions } = await import('@pnpm/deps.github-actions')
|
|
const { handler } = await import('../../src/update/index.js')
|
|
|
|
beforeEach(() => {
|
|
jest.mocked(findOutdatedGitHubActions).mockClear()
|
|
prepare({})
|
|
fs.mkdirSync(path.join('.github', 'workflows'), { recursive: true })
|
|
fs.writeFileSync(path.join('.github', 'workflows', 'ci.yml'), `jobs:
|
|
test:
|
|
steps:
|
|
- uses: actions/checkout@v4.1.0
|
|
`)
|
|
})
|
|
|
|
test('update --interactive does not look for GitHub Actions updates by default', async () => {
|
|
await handler({
|
|
...DEFAULT_OPTS,
|
|
dir: process.cwd(),
|
|
interactive: true,
|
|
})
|
|
|
|
expect(findOutdatedGitHubActions).not.toHaveBeenCalled()
|
|
})
|
|
|
|
test('update --interactive looks for GitHub Actions updates with --include-github-actions', async () => {
|
|
await handler({
|
|
...DEFAULT_OPTS,
|
|
dir: process.cwd(),
|
|
includeGithubActions: true,
|
|
interactive: true,
|
|
})
|
|
|
|
expect(findOutdatedGitHubActions).toHaveBeenCalledWith(expect.objectContaining({ dir: process.cwd() }))
|
|
})
|
|
|
|
test('update --interactive looks for GitHub Actions updates when update.githubActions is true', async () => {
|
|
await handler({
|
|
...DEFAULT_OPTS,
|
|
dir: process.cwd(),
|
|
interactive: true,
|
|
updateConfig: { githubActions: true },
|
|
})
|
|
|
|
expect(findOutdatedGitHubActions).toHaveBeenCalledWith(expect.objectContaining({ dir: process.cwd() }))
|
|
})
|