Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump @actions/attest from 1.4.1 to 1.4.2 #225

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Comment on lines -15 to +11
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic to calculate the correct issuer has been moved into the buildSLSAProvenancePredicate function.


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}`
}
Loading