Skip to content

Commit

Permalink
bump @actions/attest from 1.4.1 to 1.4.2 (#225)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <[email protected]>
  • Loading branch information
bdehamer authored Sep 5, 2024
1 parent d438876 commit f1185f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 55 deletions.
31 changes: 10 additions & 21 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "actions/attest-build-provenance",
"description": "Generate signed build provenance attestations",
"version": "1.1.2",
"version": "1.1.3",
"author": "",
"private": true,
"homepage": "https://github.com/actions/attest-build-provenance",
Expand Down Expand Up @@ -70,7 +70,7 @@
]
},
"dependencies": {
"@actions/attest": "^1.4.1",
"@actions/attest": "^1.4.2",
"@actions/core": "^1.10.1"
},
"devDependencies": {
Expand Down
27 changes: 1 addition & 26 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
import { buildSLSAProvenancePredicate } from '@actions/attest'
import * as core from '@actions/core'

const VALID_SERVER_URLS = [
'https://github.com',
new RegExp('^https://[a-z0-9-]+\\.ghe\\.com$')
] as const

/**
* The main function for the action.
* @returns {Promise<void>} Resolves when the action is complete.
*/
export async function run(): Promise<void> {
try {
const issuer = getIssuer()

// Calculate subject from inputs and generate provenance
const predicate = await buildSLSAProvenancePredicate(issuer)
const predicate = await buildSLSAProvenancePredicate()

core.setOutput('predicate', predicate.params)
core.setOutput('predicate-type', predicate.type)
Expand All @@ -25,21 +18,3 @@ export async function run(): Promise<void> {
core.setFailed(error.message)
}
}

// Derive the current OIDC issuer based on the server URL
function getIssuer(): string {
const serverURL = process.env.GITHUB_SERVER_URL || 'https://github.com'

// Ensure the server URL is a valid GitHub server URL
if (!VALID_SERVER_URLS.some(valid_url => serverURL.match(valid_url))) {
throw new Error(`Invalid server URL: ${serverURL}`)
}

let host = new URL(serverURL).hostname

if (host === 'github.com') {
host = 'githubusercontent.com'
}

return `https://token.actions.${host}`
}

0 comments on commit f1185f1

Please sign in to comment.