Skip to content

Commit a53b192

Browse files
committed
Switch to JS action
1 parent 84e1868 commit a53b192

File tree

4 files changed

+11
-41
lines changed

4 files changed

+11
-41
lines changed

actions/installer/action.yml

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,10 @@ description: 'Installs SLSA verifier and adds it to your PATH'
1717
branding:
1818
icon: 'package'
1919
color: 'blue'
20+
inputs:
21+
github-token:
22+
description: 'GitHub token'
23+
required: true
2024
runs:
21-
using: 'composite'
22-
steps:
23-
- name: Get Action Ref
24-
shell: bash
25-
env:
26-
ACTION_REF: "${{ github.action_ref }}"
27-
run: echo "action_ref=$ACTION_REF" >> $GITHUB_ENV
28-
- name: Checkout
29-
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3.1.0
30-
with:
31-
repository: "slsa-framework/slsa-verifier"
32-
ref: "${{ env.action_ref }}"
33-
- name: Setup Node.js 16
34-
uses: actions/setup-node@969bd2663942d722d85b6a8626225850c2f7be4b # tag=v3.5.0
35-
with:
36-
node-version: 16
37-
38-
- name: Install dependencies
39-
working-directory: actions/installer
40-
shell: bash
41-
run: npm ci
42-
43-
- name: Run build
44-
working-directory: actions/installer
45-
shell: bash
46-
run: npm run build
47-
48-
- name: Run installer
49-
env:
50-
ACTION_REF: "${{ github.action_ref }}"
51-
TOKEN: "${{ github.token }}"
52-
REPOSITORY: "${{ github.repository }}"
53-
working-directory: actions/installer/dist
54-
shell: bash
55-
run: npm start
56-
25+
using: 'node16'
26+
main: 'dist/index.js'

actions/installer/dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function getVerifierVersion(actionRef) {
8181
// If actionRef is a commit SHA, then find the associated version number.
8282
const shaRe = /^[a-f\d]{40}$/;
8383
if (shaRe.test(actionRef)) {
84-
const octokit = github.getOctokit(process.env.TOKEN || "");
84+
const octokit = github.getOctokit(core.getInput('github-token'));
8585
const { data: tags } = yield octokit.request("GET /repos/{owner}/{repository}/tags", {
8686
owner: "slsa-framework",
8787
repository: "slsa-verifier",
@@ -120,7 +120,7 @@ function cleanup() {
120120
function run() {
121121
return __awaiter(this, void 0, void 0, function* () {
122122
// Get requested verifier version and validate
123-
const actionRef = process.env.ACTION_REF || "";
123+
const actionRef = process.env.GITHUB_ACTION_REF || "";
124124
let version;
125125
try {
126126
version = yield getVerifierVersion(actionRef);

actions/installer/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

actions/installer/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function getVerifierVersion(actionRef: string): Promise<string> {
4343
// If actionRef is a commit SHA, then find the associated version number.
4444
const shaRe = /^[a-f\d]{40}$/;
4545
if (shaRe.test(actionRef)) {
46-
const octokit = github.getOctokit(process.env.TOKEN || "");
46+
const octokit = github.getOctokit(core.getInput("github-token"));
4747
const { data: tags } = await octokit.request(
4848
"GET /repos/{owner}/{repository}/tags",
4949
{
@@ -88,7 +88,7 @@ async function cleanup(): Promise<void> {
8888

8989
async function run(): Promise<void> {
9090
// Get requested verifier version and validate
91-
const actionRef = process.env.ACTION_REF || "";
91+
const actionRef = process.env.GITHUB_ACTION_REF || "";
9292
let version: string;
9393
try {
9494
version = await getVerifierVersion(actionRef);

0 commit comments

Comments
 (0)