Skip to content

Commit

Permalink
integration test for signing w/ GH Sigstore (#40)
Browse files Browse the repository at this point in the history
* integration test for signing w/ GH Sigstore

Signed-off-by: Brian DeHamer <[email protected]>

* switch input name to 'private-signing'

Signed-off-by: Brian DeHamer <[email protected]>

---------

Signed-off-by: Brian DeHamer <[email protected]>
  • Loading branch information
bdehamer authored Nov 27, 2023
1 parent 84fb902 commit 909b30c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,24 @@ jobs:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

test-action-private:
name: GitHub Actions Test (Private)
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write

steps:
- name: Checkout
id: checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Test Local Action
id: test-action
env:
INPUT_PRIVATE-SIGNING: 'true'
uses: ./
with:
subject-digest: 'sha256:7d070f6b64d9bcc530fe99cc21eaaa4b3c364e0b2d367d7735671fa202a03b32'
subject-name: 'subject'
6 changes: 4 additions & 2 deletions dist/index.js

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

6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ const COLOR_DEFAULT = '\x1B[39m'
*/
export async function run(): Promise<void> {
// Provenance visibility will be public ONLY if we can confirm that the
// repository is public. Otherwise, it will be private.
// repository is public AND the undocumented "private-signing" arg is NOT set.
// Otherwise, it will be private.
const visibility =
github.context.payload.repository?.visibility === 'public'
github.context.payload.repository?.visibility === 'public' &&
core.getInput('private-signing') !== 'true'
? 'public'
: 'private'
core.debug(`Provenance attestation visibility: ${visibility}`)
Expand Down

0 comments on commit 909b30c

Please sign in to comment.