Skip to content

Instantly share code, notes, and snippets.

@ShogunPanda
Created August 29, 2025 11:24
Show Gist options
  • Save ShogunPanda/66276ae5b70451ff31cc1381767db7b2 to your computer and use it in GitHub Desktop.
Save ShogunPanda/66276ae5b70451ff31cc1381767db7b2 to your computer and use it in GitHub Desktop.
npm-automated-oidc-setup.ts
// Run via npx playwright test --headed oidc.test.ts
import { expect, test } from '@playwright/test'
const packages = [
/*
Define packages here - format:
{
name: '', // package name without @
organization: '',
repository: '',
workflow: '',
environment: ''
}
*/
]
// Obtain via npx playwright codegen --save-storage=auth.json https://npmjs.com
test.use({ storageState: 'auth.json' })
for (const {name, organization, repository, environment} of packages) {
test(`Setup OIDC - ${name}`, async ({ page }) => {
await page.goto(`https://www.npmjs.com/package/${name}/access`)
await page.getByText('GitHub Actions').click()
await expect(page.getByText('Publisher*')).toBeVisible()
await page.getByLabel('Organization or user*').fill(organization)
await page.getByLabel('Repository*').fill(repository)
await page.getByLabel('Workflow filename*').fill(workflow)
await page.getByLabel('Environment name').fill(environment)
await page.getByText('Set up connection').click()
await expect(page.locator('#deleteOidc')).toBeVisible()
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment