Created
August 29, 2025 11:24
-
-
Save ShogunPanda/66276ae5b70451ff31cc1381767db7b2 to your computer and use it in GitHub Desktop.
npm-automated-oidc-setup.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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