Skip to content

Commit

Permalink
Aligns Action with common format (#13)
Browse files Browse the repository at this point in the history
* updates workflows

* updates README

* adds support for `copywrite`

* cleans up dependencies
  • Loading branch information
ksatirli authored May 6, 2024
1 parent 961c9eb commit 14424f0
Show file tree
Hide file tree
Showing 19 changed files with 245 additions and 248 deletions.
12 changes: 10 additions & 2 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: Apache-2.0

schema_version = 1

project {
header_ignore = [
"dist/index.js"
license = "Apache-2.0"
copyright_holder = "HashiCorp, Inc."
copyright_year = 2022

header_ignore = [
"dist/*",
"node_modules/",
]
}
6 changes: 3 additions & 3 deletions .github/workflows/actions-self-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ on:
push:

env:
PRODUCT_VERSION: "0.0.1-techpreview.3"
PRODUCT_HASH: "3b4163b"
PRODUCT_VERSION: "0.1.1"
PRODUCT_HASH: "5159a77"

jobs:
setup-nomad-pack:
Expand All @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup `nomad-pack` (using local GitHub Action)
uses: "./"
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---

name: "HashiCorp: Compliance"

on:
push:

permissions:
contents: read

jobs:
copywrite:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

- uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2

- run: copywrite headers --plan

- run: copywrite license --plan
40 changes: 0 additions & 40 deletions .github/workflows/snyk.yml

This file was deleted.

5 changes: 3 additions & 2 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---

name: "Code Quality: Super-Linter"

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

- name: Lint Code with Super-Linter
uses: github/super-linter@45fc0d88288beee4701c62761281edfee85655d7 # v5.0.0
uses: github/super-linter/slim@45fc0d88288beee4701c62761281edfee85655d7 # v5.0.0
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: "main"
Expand Down
19 changes: 14 additions & 5 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
name: Node.js
runs-on: ubuntu-latest

env:
PACKAGES: "@vercel/ncc prettier"

strategy:
# see https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
fail-fast: false
Expand All @@ -18,18 +21,24 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 1

- name: Set up Node.js
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'

- name: Install NPM Packages
run: npm ci
- name: Install global NPM packages
run: npm install --global ${PACKAGES}

- name: Install Action-specific NPM Packages
run: npm install-clean

- name: Build TypeScript code
run: npm run build
run: |
npm run-script fmt \
&& \
npm run-script build
19 changes: 0 additions & 19 deletions .snyk

This file was deleted.

18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The `hashicorp/setup-nomad-pack` Action sets up the [Nomad Pack](https://develop
## Table of Contents

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

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

on:
- push
push:

env:
PRODUCT_VERSION: "0.0.1-techpreview.3"
PRODUCT_VERSION: "0.1.1"

jobs:
setup-nomad-pack:
runs-on: ubuntu-latest
name: Run Nomad Pack
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup `nomad-pack`
uses: hashicorp/setup-nomad-pack@v1.0.0
uses: hashicorp/setup-nomad-pack@main
id: setup
with:
version: ${{ env.PRODUCT_VERSION }}
Expand All @@ -87,8 +87,8 @@ jobs:
In the above example, the following definitions have been set.
- 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).
- 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).
- 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/).
- 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).
- 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/).
- The pack to interact with has been set to `./test`

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.
Expand All @@ -111,8 +111,6 @@ This section contains a list of all outputs that can be consumed from this Actio

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

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.

## License

Licensed under the Apache License, Version 2.0 (the "License").
Expand Down
6 changes: 4 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.PRODUCT = void 0;
const core = __importStar(__nccwpck_require__(6024));
const hc = __importStar(__nccwpck_require__(2999));
exports.PRODUCT = "nomad-pack";
function main() {
return __awaiter(this, void 0, void 0, function* () {
const version = core.getInput("version");
Expand All @@ -49,7 +51,7 @@ function main() {
return;
}
try {
yield hc.getHashicorpRelease("nomad-pack", version);
yield hc.getHashicorpRelease(exports.PRODUCT, version);
}
catch (error) {
if (error instanceof Error) {
Expand Down Expand Up @@ -620,7 +622,7 @@ class OidcClient {
.catch(error => {
throw new Error(`Failed to get ID Token. \n
Error Code : ${error.statusCode}\n
Error Message: ${error.result.message}`);
Error Message: ${error.message}`);
});
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

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

Loading

0 comments on commit 14424f0

Please sign in to comment.