Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79a47d255a | ||
|
|
b39d573389 | ||
|
|
30289d37f7 | ||
|
|
5deef5c6b4 | ||
|
|
6422c3bb5d | ||
|
|
2785fc91aa |
@@ -63,8 +63,6 @@ export type AttestOptions = {
|
|||||||
// Sigstore instance to use for signing. Must be one of "public-good" or
|
// Sigstore instance to use for signing. Must be one of "public-good" or
|
||||||
// "github".
|
// "github".
|
||||||
sigstore?: 'public-good' | 'github'
|
sigstore?: 'public-good' | 'github'
|
||||||
// HTTP headers to include in request to attestations API.
|
|
||||||
headers?: {[header: string]: string | number | undefined}
|
|
||||||
// Whether to skip writing the attestation to the GH attestations API.
|
// Whether to skip writing the attestation to the GH attestations API.
|
||||||
skipWrite?: boolean
|
skipWrite?: boolean
|
||||||
}
|
}
|
||||||
@@ -115,8 +113,6 @@ export type AttestProvenanceOptions = {
|
|||||||
// Sigstore instance to use for signing. Must be one of "public-good" or
|
// Sigstore instance to use for signing. Must be one of "public-good" or
|
||||||
// "github".
|
// "github".
|
||||||
sigstore?: 'public-good' | 'github'
|
sigstore?: 'public-good' | 'github'
|
||||||
// HTTP headers to include in request to attestations API.
|
|
||||||
headers?: {[header: string]: string | number | undefined}
|
|
||||||
// Whether to skip writing the attestation to the GH attestations API.
|
// Whether to skip writing the attestation to the GH attestations API.
|
||||||
skipWrite?: boolean
|
skipWrite?: boolean
|
||||||
// Issuer URL responsible for minting the OIDC token from which the
|
// Issuer URL responsible for minting the OIDC token from which the
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
# @actions/attest Releases
|
# @actions/attest Releases
|
||||||
|
|
||||||
### 1.4.0
|
|
||||||
|
|
||||||
- Add new `headers` parameter to the `attest` and `attestProvenance` functions.
|
|
||||||
|
|
||||||
### 1.3.1
|
### 1.3.1
|
||||||
|
|
||||||
- Fix bug with proxy support when retrieving JWKS for OIDC issuer
|
- Fix bug with proxy support when retrieving JWKS for OIDC issuer
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ describe('writeAttestation', () => {
|
|||||||
const originalEnv = process.env
|
const originalEnv = process.env
|
||||||
const attestation = {foo: 'bar '}
|
const attestation = {foo: 'bar '}
|
||||||
const token = 'token'
|
const token = 'token'
|
||||||
const headers = {'X-GitHub-Foo': 'true'}
|
|
||||||
|
|
||||||
const mockAgent = new MockAgent()
|
const mockAgent = new MockAgent()
|
||||||
setGlobalDispatcher(mockAgent)
|
setGlobalDispatcher(mockAgent)
|
||||||
@@ -28,16 +27,14 @@ describe('writeAttestation', () => {
|
|||||||
.intercept({
|
.intercept({
|
||||||
path: '/repos/foo/bar/attestations',
|
path: '/repos/foo/bar/attestations',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {authorization: `token ${token}`, ...headers},
|
headers: {authorization: `token ${token}`},
|
||||||
body: JSON.stringify({bundle: attestation})
|
body: JSON.stringify({bundle: attestation})
|
||||||
})
|
})
|
||||||
.reply(201, {id: '123'})
|
.reply(201, {id: '123'})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('persists the attestation', async () => {
|
it('persists the attestation', async () => {
|
||||||
await expect(
|
await expect(writeAttestation(attestation, token)).resolves.toEqual('123')
|
||||||
writeAttestation(attestation, token, {headers})
|
|
||||||
).resolves.toEqual('123')
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/attest",
|
"name": "@actions/attest",
|
||||||
"version": "1.4.0",
|
"version": "1.3.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@actions/attest",
|
"name": "@actions/attest",
|
||||||
"version": "1.4.0",
|
"version": "1.3.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/attest",
|
"name": "@actions/attest",
|
||||||
"version": "1.4.0",
|
"version": "1.3.1",
|
||||||
"description": "Actions attestation lib",
|
"description": "Actions attestation lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ export type AttestOptions = {
|
|||||||
// Sigstore instance to use for signing. Must be one of "public-good" or
|
// Sigstore instance to use for signing. Must be one of "public-good" or
|
||||||
// "github".
|
// "github".
|
||||||
sigstore?: SigstoreInstance
|
sigstore?: SigstoreInstance
|
||||||
// HTTP headers to include in request to attestations API.
|
|
||||||
headers?: {[header: string]: string | number | undefined}
|
|
||||||
// Whether to skip writing the attestation to the GH attestations API.
|
// Whether to skip writing the attestation to the GH attestations API.
|
||||||
skipWrite?: boolean
|
skipWrite?: boolean
|
||||||
}
|
}
|
||||||
@@ -63,11 +61,7 @@ export async function attest(options: AttestOptions): Promise<Attestation> {
|
|||||||
// Store the attestation
|
// Store the attestation
|
||||||
let attestationID: string | undefined
|
let attestationID: string | undefined
|
||||||
if (options.skipWrite !== true) {
|
if (options.skipWrite !== true) {
|
||||||
attestationID = await writeAttestation(
|
attestationID = await writeAttestation(bundleToJSON(bundle), options.token)
|
||||||
bundleToJSON(bundle),
|
|
||||||
options.token,
|
|
||||||
{headers: options.headers}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return toAttestation(bundle, attestationID)
|
return toAttestation(bundle, attestationID)
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {retry} from '@octokit/plugin-retry'
|
import {retry} from '@octokit/plugin-retry'
|
||||||
import {RequestHeaders} from '@octokit/types'
|
|
||||||
|
|
||||||
const CREATE_ATTESTATION_REQUEST = 'POST /repos/{owner}/{repo}/attestations'
|
const CREATE_ATTESTATION_REQUEST = 'POST /repos/{owner}/{repo}/attestations'
|
||||||
const DEFAULT_RETRY_COUNT = 5
|
const DEFAULT_RETRY_COUNT = 5
|
||||||
|
|
||||||
export type WriteOptions = {
|
export type WriteOptions = {
|
||||||
retry?: number
|
retry?: number
|
||||||
headers?: RequestHeaders
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Writes an attestation to the repository's attestations endpoint.
|
* Writes an attestation to the repository's attestations endpoint.
|
||||||
@@ -28,7 +26,6 @@ export const writeAttestation = async (
|
|||||||
const response = await octokit.request(CREATE_ATTESTATION_REQUEST, {
|
const response = await octokit.request(CREATE_ATTESTATION_REQUEST, {
|
||||||
owner: github.context.repo.owner,
|
owner: github.context.repo.owner,
|
||||||
repo: github.context.repo.repo,
|
repo: github.context.repo.repo,
|
||||||
headers: options.headers,
|
|
||||||
data: {bundle: attestation}
|
data: {bundle: attestation}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
# @actions/glob Releases
|
# @actions/glob Releases
|
||||||
|
|
||||||
### 0.5.0
|
|
||||||
- Added `excludeHiddenFiles` option, which is disabled by default to preserve existing behavior [#1791: Add glob option to ignore hidden files](https://github.com/actions/toolkit/pull/1791)
|
|
||||||
|
|
||||||
### 0.4.0
|
### 0.4.0
|
||||||
- Pass in the current workspace as a parameter to HashFiles [#1318](https://github.com/actions/toolkit/pull/1318)
|
- Pass in the current workspace as a parameter to HashFiles [#1318](https://github.com/actions/toolkit/pull/1318)
|
||||||
|
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ describe('globber', () => {
|
|||||||
expect(itemPaths).toEqual([])
|
expect(itemPaths).toEqual([])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('returns hidden files by default', async () => {
|
it('returns hidden files', async () => {
|
||||||
// Create the following layout:
|
// Create the following layout:
|
||||||
// <root>
|
// <root>
|
||||||
// <root>/.emptyFolder
|
// <root>/.emptyFolder
|
||||||
@@ -734,26 +734,6 @@ describe('globber', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('ignores hidden files when excludeHiddenFiles is set', async () => {
|
|
||||||
// Create the following layout:
|
|
||||||
// <root>
|
|
||||||
// <root>/.emptyFolder
|
|
||||||
// <root>/.file
|
|
||||||
// <root>/.folder
|
|
||||||
// <root>/.folder/file
|
|
||||||
const root = path.join(getTestTemp(), 'ignores-hidden-files')
|
|
||||||
await createHiddenDirectory(path.join(root, '.emptyFolder'))
|
|
||||||
await createHiddenDirectory(path.join(root, '.folder'))
|
|
||||||
await createHiddenFile(path.join(root, '.file'), 'test .file content')
|
|
||||||
await fs.writeFile(
|
|
||||||
path.join(root, '.folder', 'file'),
|
|
||||||
'test .folder/file content'
|
|
||||||
)
|
|
||||||
|
|
||||||
const itemPaths = await glob(root, {excludeHiddenFiles: true})
|
|
||||||
expect(itemPaths).toEqual([root])
|
|
||||||
})
|
|
||||||
|
|
||||||
it('returns normalized paths', async () => {
|
it('returns normalized paths', async () => {
|
||||||
// Create the following layout:
|
// Create the following layout:
|
||||||
// <root>/hello/world.txt
|
// <root>/hello/world.txt
|
||||||
|
|||||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/glob",
|
"name": "@actions/glob",
|
||||||
"version": "0.5.0",
|
"version": "0.4.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"description": "Actions glob lib",
|
"description": "Actions glob lib",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/glob",
|
"name": "@actions/glob",
|
||||||
"version": "0.5.0",
|
"version": "0.4.0",
|
||||||
"preview": true,
|
"preview": true,
|
||||||
"description": "Actions glob lib",
|
"description": "Actions glob lib",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ export function getOptions(copy?: GlobOptions): GlobOptions {
|
|||||||
followSymbolicLinks: true,
|
followSymbolicLinks: true,
|
||||||
implicitDescendants: true,
|
implicitDescendants: true,
|
||||||
matchDirectories: true,
|
matchDirectories: true,
|
||||||
omitBrokenSymbolicLinks: true,
|
omitBrokenSymbolicLinks: true
|
||||||
excludeHiddenFiles: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy) {
|
if (copy) {
|
||||||
@@ -33,11 +32,6 @@ export function getOptions(copy?: GlobOptions): GlobOptions {
|
|||||||
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks
|
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks
|
||||||
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`)
|
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof copy.excludeHiddenFiles === 'boolean') {
|
|
||||||
result.excludeHiddenFiles = copy.excludeHiddenFiles
|
|
||||||
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -36,13 +36,4 @@ export interface GlobOptions {
|
|||||||
* @default true
|
* @default true
|
||||||
*/
|
*/
|
||||||
omitBrokenSymbolicLinks?: boolean
|
omitBrokenSymbolicLinks?: boolean
|
||||||
|
|
||||||
/**
|
|
||||||
* Indicates whether to exclude hidden files (files and directories starting with a `.`).
|
|
||||||
* This does not apply to Windows files and directories with the hidden attribute unless
|
|
||||||
* they are also prefixed with a `.`.
|
|
||||||
*
|
|
||||||
* @default false
|
|
||||||
*/
|
|
||||||
excludeHiddenFiles?: boolean
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,11 +128,6 @@ export class DefaultGlobber implements Globber {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hidden file or directory?
|
|
||||||
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Directory
|
// Directory
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
// Matched
|
// Matched
|
||||||
|
|||||||
Reference in New Issue
Block a user