-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
52 lines (42 loc) · 1.58 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Action's main info
name: "Packj NPM Registry Firewall Setup"
description: 'Packj NPM Firewall blocks installation of vulnerable/abandonded/malicious open-source dependencies'
# Action's author name
author: "Ossillate, Inc."
# Action's branding data for GitHub Marketplace
branding:
icon: "package" # icon name from Feather open source icons pack
color: "orange"
inputs:
PACKJ_FIREWALL_TOKEN:
description: Your Packj Firewall service token
required: true
NODE_VERSION:
description: Node version to use
required: false
default: '16'
REGISTRY_URL:
description: URL to NPM registry (no trailing slash)
required: false
default: 'https://npmjs.packj.dev'
runs:
using: "composite"
steps:
- name: Generate Auth token
shell: bash
run: |
echo "Setting NPM package registry to ${{ inputs.REGISTRY_URL }}"
# Server URL
echo "SERVER_URL=$(echo -n ${{ github.server_url }} | base64 -w0)" >> $GITHUB_ENV
# Repository ID
echo "REPO_ID=$(echo -n ${{ github.repository }} | base64 -w0)" >> $GITHUB_ENV
# Workflow details
echo "WORKFLOW_DETAILS=$(echo -n ${{ github.run_id }}:${{ github.run_number }}:${{ github.sha }} | base64 -w0)" >> $GITHUB_ENV
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.NODE_VERSION }}
always-auth: true
registry-url: ${{ inputs.REGISTRY_URL }}
env:
NODE_AUTH_TOKEN: ${{ env.SERVER_URL }}:${{ env.REPO_ID }}:${{ env.WORKFLOW_DETAILS }}:${{ inputs.PACKJ_FIREWALL_TOKEN }}