Skip to content

Commit 14424f0

Browse files
authoredMay 6, 2024··
Aligns Action with common format (#13)
* updates workflows * updates README * adds support for `copywrite` * cleans up dependencies
1 parent 961c9eb commit 14424f0

19 files changed

+245
-248
lines changed
 

‎.copywrite.hcl

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1+
# Copyright (c) HashiCorp, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
14
schema_version = 1
25

36
project {
4-
header_ignore = [
5-
"dist/index.js"
7+
license = "Apache-2.0"
8+
copyright_holder = "HashiCorp, Inc."
9+
copyright_year = 2022
10+
11+
header_ignore = [
12+
"dist/*",
13+
"node_modules/",
614
]
715
}

‎.github/workflows/actions-self-test.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ on:
44
push:
55

66
env:
7-
PRODUCT_VERSION: "0.0.1-techpreview.3"
8-
PRODUCT_HASH: "3b4163b"
7+
PRODUCT_VERSION: "0.1.1"
8+
PRODUCT_HASH: "5159a77"
99

1010
jobs:
1111
setup-nomad-pack:
@@ -14,7 +14,7 @@ jobs:
1414

1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
1818

1919
- name: Setup `nomad-pack` (using local GitHub Action)
2020
uses: "./"

‎.github/workflows/compliance.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
3+
name: "HashiCorp: Compliance"
4+
5+
on:
6+
push:
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
copywrite:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout Repository
16+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
17+
with:
18+
# Full git history is needed to get a proper list of changed files within `super-linter`
19+
fetch-depth: 0
20+
21+
- uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2
22+
23+
- run: copywrite headers --plan
24+
25+
- run: copywrite license --plan

‎.github/workflows/snyk.yml

-40
This file was deleted.

‎.github/workflows/superlinter.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
23
name: "Code Quality: Super-Linter"
34

45
on:
@@ -10,13 +11,13 @@ jobs:
1011
runs-on: ubuntu-latest
1112
steps:
1213
- name: Checkout Repository
13-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
14+
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
1415
with:
1516
# Full git history is needed to get a proper list of changed files within `super-linter`
1617
fetch-depth: 0
1718

1819
- name: Lint Code with Super-Linter
19-
uses: github/super-linter@45fc0d88288beee4701c62761281edfee85655d7 # v5.0.0
20+
uses: github/super-linter/slim@45fc0d88288beee4701c62761281edfee85655d7 # v5.0.0
2021
env:
2122
VALIDATE_ALL_CODEBASE: true
2223
DEFAULT_BRANCH: "main"

‎.github/workflows/typescript.yml

+14-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
name: Node.js
1010
runs-on: ubuntu-latest
1111

12+
env:
13+
PACKAGES: "@vercel/ncc prettier"
14+
1215
strategy:
1316
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
1417
fail-fast: false
@@ -18,18 +21,24 @@ jobs:
1821

1922
steps:
2023
- name: Checkout Repository
21-
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
24+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
2225
with:
2326
fetch-depth: 1
2427

2528
- name: Set up Node.js
26-
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
29+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
2730
with:
2831
node-version: ${{ matrix.node-version }}
2932
cache: 'npm'
3033

31-
- name: Install NPM Packages
32-
run: npm ci
34+
- name: Install global NPM packages
35+
run: npm install --global ${PACKAGES}
36+
37+
- name: Install Action-specific NPM Packages
38+
run: npm install-clean
3339

3440
- name: Build TypeScript code
35-
run: npm run build
41+
run: |
42+
npm run-script fmt \
43+
&& \
44+
npm run-script build

‎.snyk

-19
This file was deleted.

‎README.md

+8-10
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The `hashicorp/setup-nomad-pack` Action sets up the [Nomad Pack](https://develop
77
## Table of Contents
88

99
<!-- TOC -->
10-
* [GitHub Action: `setup-nomad-pack`](#github-action--setup-nomad-pack)
10+
* [GitHub Action: `setup-nomad-pack`](#github-action-setup-nomad-pack)
1111
* [Table of Contents](#table-of-contents)
1212
* [Requirements](#requirements)
1313
* [Usage](#usage)
@@ -35,7 +35,7 @@ Other [environment variables](https://developer.hashicorp.com/nomad/docs/command
3535
Optionally, set any and all [environment variables](https://developer.hashicorp.com/nomad/docs/commands#environment-variables) as required for your Nomad cluster.
3636

3737
> **Warning**
38-
> Running services such as Nomad on a publicly accessible port without authentication is a decidedly bad idea.
38+
> Running services such as Nomad on a publicly accessible port without authentication may be harmful.
3939
>
4040
> Consult with your security team to define an access policy that meets your organization's security demands.
4141
@@ -48,21 +48,21 @@ This data may be retrieved through [HashiCorp Terraform](https://terraform.io/),
4848
name: nomad-pack
4949

5050
on:
51-
- push
51+
push:
5252

5353
env:
54-
PRODUCT_VERSION: "0.0.1-techpreview.3"
54+
PRODUCT_VERSION: "0.1.1"
5555

5656
jobs:
5757
setup-nomad-pack:
5858
runs-on: ubuntu-latest
5959
name: Run Nomad Pack
6060
steps:
6161
- name: Checkout
62-
uses: actions/checkout@v3
62+
uses: actions/checkout@v4
6363

6464
- name: Setup `nomad-pack`
65-
uses: hashicorp/setup-nomad-pack@v1.0.0
65+
uses: hashicorp/setup-nomad-pack@main
6666
id: setup
6767
with:
6868
version: ${{ env.PRODUCT_VERSION }}
@@ -87,8 +87,8 @@ jobs:
8787
In the above example, the following definitions have been set.
8888
8989
- The event trigger has been set to `push`. For a complete list, see [Events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).
90-
- The origin of this GitHub Action has been set as `hashicorp/setup-nomad-pack@1.0.0`. For newer versions, see the [Releases](https://github.com/hashicorp/setup-nomad-pack/releases).
91-
- The version of `nomad-pack` to set up has been set as `0.0.1-techpreview.3`. For a complete list, see [releases.hashicorp.com](https://releases.hashicorp.com/nomad-pack/).
90+
- The origin of this GitHub Action has been set as `hashicorp/setup-nomad-pack@main`. For newer versions, see the [Releases](https://github.com/hashicorp/setup-nomad-pack/releases).
91+
- The version of `nomad-pack` to set up has been set as `0.1.1`. For a complete list, see [releases.hashicorp.com](https://releases.hashicorp.com/nomad-pack/).
9292
- The pack to interact with has been set to `./test`
9393

9494
These definitions may require updating to suit your deployment, such as specifying [self-hosted](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#choosing-self-hosted-runners) runners.
@@ -111,8 +111,6 @@ This section contains a list of all outputs that can be consumed from this Actio
111111

112112
This GitHub Action is maintained by the contributors listed on [GitHub](https://github.com/hashicorp/setup-nomad-pack/graphs/contributors).
113113

114-
The original code of this repository is based on work done by [Matthew Sanabria](https://github.com/sudomateo) as part of the [setup-packer](https://github.com/sudomateo/setup-packer) GitHub Action.
115-
116114
## License
117115

118116
Licensed under the Apache License, Version 2.0 (the "License").

‎dist/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3939
});
4040
};
4141
Object.defineProperty(exports, "__esModule", ({ value: true }));
42+
exports.PRODUCT = void 0;
4243
const core = __importStar(__nccwpck_require__(6024));
4344
const hc = __importStar(__nccwpck_require__(2999));
45+
exports.PRODUCT = "nomad-pack";
4446
function main() {
4547
return __awaiter(this, void 0, void 0, function* () {
4648
const version = core.getInput("version");
@@ -49,7 +51,7 @@ function main() {
4951
return;
5052
}
5153
try {
52-
yield hc.getHashicorpRelease("nomad-pack", version);
54+
yield hc.getHashicorpRelease(exports.PRODUCT, version);
5355
}
5456
catch (error) {
5557
if (error instanceof Error) {
@@ -620,7 +622,7 @@ class OidcClient {
620622
.catch(error => {
621623
throw new Error(`Failed to get ID Token. \n
622624
Error Code : ${error.statusCode}\n
623-
Error Message: ${error.result.message}`);
625+
Error Message: ${error.message}`);
624626
});
625627
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
626628
if (!id_token) {

‎dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.