Skip to content

Commit

Permalink
Attempt to use attestation API
Browse files Browse the repository at this point in the history
Signed-off-by: John Kjell <[email protected]>
  • Loading branch information
jkjell committed Apr 13, 2024
1 parent a75fe22 commit 7ba4423
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/test_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ jobs:
step: test
command: echo hello > hello.txt
enable-sigstore: true
enable-archivista: true
enable-archivista: true
token: ${{ secrets.ATTESTATION_TOKEN }}
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ inputs:
workingdir:
description: "Directory from which commands will run"
required: false
token:
description: "GitHub Attestation store token"
required: false

runs:
using: "node20"
Expand Down
36 changes: 36 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28565,6 +28565,14 @@ function version(uuid) {
var _default = version;
exports["default"] = _default;

/***/ }),

/***/ 141:
/***/ ((module) => {

module.exports = eval("require")("@actions/attest");


/***/ }),

/***/ 9491:
Expand Down Expand Up @@ -28679,6 +28687,22 @@ module.exports = require("node:events");

/***/ }),

/***/ 3977:
/***/ ((module) => {

"use strict";
module.exports = require("node:fs/promises");

/***/ }),

/***/ 9411:
/***/ ((module) => {

"use strict";
module.exports = require("node:path");

/***/ }),

/***/ 4492:
/***/ ((module) => {

Expand Down Expand Up @@ -30484,6 +30508,7 @@ const fs = __nccwpck_require__(7147);
const os = __nccwpck_require__(2037);
const path = __nccwpck_require__(1017);
const tc = __nccwpck_require__(2275);
const att = __nccwpck_require__(141);

async function run() {
// Download Witness
Expand Down Expand Up @@ -30524,6 +30549,7 @@ async function run() {
let fulcioOidcClientId = core.getInput("fulcio-oidc-client-id");
let fulcioOidcIssuer = core.getInput("fulcio-oidc-issuer");
const fulcioToken = core.getInput("fulcio-token");
const token = core.getInput("token");
const intermediates = core.getInput("intermediates").split(" ");
const key = core.getInput("key");
let outfile = core.getInput("outfile");
Expand Down Expand Up @@ -30628,6 +30654,16 @@ async function run() {
const gitOID = extractDesiredGitOID(output);
console.log("Extracted Git OID:", gitOID);

// Attempt to upload to GitHub Attestations Beta
const { readFile } = __nccwpck_require__(3977);
const { resolve } = __nccwpck_require__(9411);

const filePath = resolve('/tmp/test-attestation.json');
const contents = await readFile(filePath, { encoding: 'utf8' });
console.log(contents);
let attestationID = await att.writeAttestation(contents, token)
console.log("Attestation ID:", attestationID);

// Print the Git OID to the output
core.setOutput("git_oid", gitOID);

Expand Down
10 changes: 10 additions & 0 deletions dist/licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

@vercel/ncc
MIT
Copyright 2018 ZEIT, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

semver
ISC
The ISC License
Expand Down
12 changes: 12 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const fs = require("fs");
const os = require("os");
const path = require("path");
const tc = require('@actions/tool-cache');
const att = require('@actions/attest');

async function run() {
// Download Witness
Expand Down Expand Up @@ -47,6 +48,7 @@ async function run() {
let fulcioOidcClientId = core.getInput("fulcio-oidc-client-id");
let fulcioOidcIssuer = core.getInput("fulcio-oidc-issuer");
const fulcioToken = core.getInput("fulcio-token");
const token = core.getInput("token");
const intermediates = core.getInput("intermediates").split(" ");
const key = core.getInput("key");
let outfile = core.getInput("outfile");
Expand Down Expand Up @@ -151,6 +153,16 @@ async function run() {
const gitOID = extractDesiredGitOID(output);
console.log("Extracted Git OID:", gitOID);

// Attempt to upload to GitHub Attestations Beta
const { readFile } = require('node:fs/promises');
const { resolve } = require('node:path');

const filePath = resolve('/tmp/test-attestation.json');
const contents = await readFile(filePath, { encoding: 'utf8' });
console.log(contents);
let attestationID = await att.writeAttestation(contents, token)
console.log("Attestation ID:", attestationID);

// Print the Git OID to the output
core.setOutput("git_oid", gitOID);

Expand Down

0 comments on commit 7ba4423

Please sign in to comment.