Skip to content

Add copyright source headers and GHA check #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
schema_version = 1

project {
license = "BUSL-1.1"
copyright_year = 2024
Comment on lines +4 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the ticket it says the license should be BSL-1.1. Which one is correct and can the wrong one be updated? Also, should the copyright_year be 2025?

Copy link
Contributor Author

@RubenSandwich RubenSandwich Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeahMarieBush Looks like it is BUSL-1.1, at least if we use the terraform repo as a source of truth:

Good question; you usually copyright when you start work, not when you release:


header_ignore = [
"public/**",
"content/**",
"docs/**",
"__fixtures__/**",
"__mocks__/**",
"**/*.json",
".next/**",
".husky/**",
"next-env.d.ts",
]
}
3 changes: 3 additions & 0 deletions .github/actions/get-vercel-preview-data/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

name: Get Vercel Preview Data
description: Fetches the latest Vercel preview, inspector URL, and created UTC for the specified project's deployment
runs:
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/get-vercel-preview-data/dist/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

Expand Down
5 changes: 5 additions & 0 deletions .github/actions/get-vercel-preview-data/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import * as core from '@actions/core'
import fetch from 'node-fetch'

Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/copyright-headers-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: 'Check Copyright Headers'

on:
pull_request:
paths:
- '**.js'
- '**.jsx'
- '**.ts'
- '**.tsx'
- '**.mjs'
push:
branches: ['main']

jobs:
check-headers:
name: 'Check Copyright Headers'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Install copywrite
uses: hashicorp/setup-copywrite@32638da2d4e81d56a0764aa1547882fc4d209636 # v1.1.3

- name: Validate Header Compliance
run: copywrite headers --plan
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

FROM node:20

WORKDIR /server
Expand Down
5 changes: 5 additions & 0 deletions app/api/all-docs-paths/route.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { expect, test, vi, afterEach } from 'vitest'
import docsPathsMock from '../../../__fixtures__/docsPathsAllVersionsMock.json'
import { GET } from './route'
Expand Down
5 changes: 5 additions & 0 deletions app/api/all-docs-paths/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { errorResultToString } from '@utils/result'
import { getDocsPaths } from '@utils/allDocsPaths'
import { PRODUCT_CONFIG } from '@utils/productConfig.mjs'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { expect, test, vi } from 'vitest'
import { GET } from './route'
import { getAssetData } from '@utils/file'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { getAssetData } from '@utils/file'
import { getProductVersion } from '@utils/contentVersions'
import { errorResultToString } from '@utils/result'
Expand Down
5 changes: 5 additions & 0 deletions app/api/content-versions/route.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { expect, test, vi, beforeEach, afterEach } from 'vitest'
import { GET } from './route'

Expand Down
5 changes: 5 additions & 0 deletions app/api/content-versions/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { findDocVersions } from '../../utils/findDocVersions'
import { PRODUCT_CONFIG } from '@utils/productConfig.mjs'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import {
expect,
describe,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { readFile, parseMarkdownFrontMatter } from '@utils/file'
import { getProductVersion } from '@utils/contentVersions'
import { errorResultToString } from '@utils/result'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import {
expect,
describe,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { readFile, parseJson } from '@utils/file'
import { getProductVersion } from '@utils/contentVersions'
import { errorResultToString } from '@utils/result'
Expand Down
5 changes: 5 additions & 0 deletions app/api/content/[productSlug]/redirects/route.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { expect, test, vi } from 'vitest'
import { GET } from './route'

Expand Down
5 changes: 5 additions & 0 deletions app/api/content/[productSlug]/redirects/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { getProductVersion } from '@utils/contentVersions'
import { readFile, parseJsonc } from '@utils/file'
import { errorResultToString } from '@utils/result'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import {
expect,
describe,
Expand Down
5 changes: 5 additions & 0 deletions app/api/content/[productSlug]/version-metadata/route.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { getProductVersionMetadata } from '@utils/contentVersions'
import { errorResultToString } from '@utils/result'

Expand Down
5 changes: 5 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import React from 'react'

// eslint-disable-next-line no-restricted-exports
Expand Down
5 changes: 5 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

/** Add your relevant code here for the issue to reproduce */
// eslint-disable-next-line no-restricted-exports
export default function Home() {
Expand Down
5 changes: 5 additions & 0 deletions app/utils/allDocsPaths.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { expect, test, vi } from 'vitest'
import { getDocsPaths } from './allDocsPaths'
import docsPathsMock from '../../__fixtures__/docsPathsAllVersionsMock.json'
Expand Down
5 changes: 5 additions & 0 deletions app/utils/allDocsPaths.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { Ok, Err, errorResultToString } from '@utils/result'
import docsPathsAllVersions from '@api/docsPathsAllVersions.json'
import { getProductVersion } from './contentVersions'
Expand Down
5 changes: 5 additions & 0 deletions app/utils/contentVersions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import versionMetadata from '@api/versionMetadata.json'
import { Ok, Err } from '@utils/result'

Expand Down
5 changes: 5 additions & 0 deletions app/utils/file.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import grayMatter from 'gray-matter'
import { parse as jsoncParse } from 'jsonc-parser'

Expand Down
5 changes: 5 additions & 0 deletions app/utils/findDocVersions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import docsPathsAllVersions from '@api/docsPathsAllVersions.json'

/**
Expand Down
5 changes: 5 additions & 0 deletions app/utils/productConfig.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import semver from 'semver'

/**
Expand Down
5 changes: 5 additions & 0 deletions app/utils/result.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

// The result type is used to represent the result of an operation that can fail. It is a common pattern in Rust and other languages. This pattern is useful for handling errors in a more structured way and avoiding exceptions. Because any error state is wrapped in Err and any success state is wrapped in Ok. See "app/utils/file.ts" for an example of how this is used.

export type Result<T, E = undefined> =
Expand Down
5 changes: 5 additions & 0 deletions app/utils/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { expect, test, vi, afterEach, beforeEach } from 'vitest'
import { vol } from 'memfs'
import {
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1

services:
dev-portal:
image: 'hashicorp/dev-portal:latest'
Expand Down
5 changes: 5 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
Expand Down
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

/** @type {import("next").NextConfig} */
const nextConfig = {
reactStrictMode: true,
Expand Down
5 changes: 5 additions & 0 deletions scripts/add-version-to-nav-data.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import fs from 'node:fs/promises'
import { PRODUCT_CONFIG } from '../app/utils/productConfig.mjs'
import semver from 'semver'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import fs from 'fs'
import algoliasearch from 'algoliasearch'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { describe, it, expect, vi, afterEach } from 'vitest'
import { batchPostRecords } from './batch-post-records-to-algolia.mjs'
import algoliasearch from 'algoliasearch'
Expand Down
5 changes: 5 additions & 0 deletions scripts/algolia/batch-post-records/index.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { batchPostRecords } from './batch-post-records-to-algolia.mjs'
import path from 'path'

Expand Down
5 changes: 5 additions & 0 deletions scripts/algolia/build-algolia-records.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import path from 'path'
import grayMatter from 'gray-matter'
import { createAlgoliaRecordObject } from './transform-mdx-to-algolia-record/create-records.mjs'
Expand Down
5 changes: 5 additions & 0 deletions scripts/algolia/convert-mdx-to-json/index.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import path from 'path'
import { readdir } from 'node:fs/promises'
import { getLatestVersion } from '../../utils/file-path/latest-version/index.mjs'
Expand Down
5 changes: 5 additions & 0 deletions scripts/algolia/convert-mdx-to-json/index.test.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { describe, test, expect, vi } from 'vitest'
import path from 'path'
import { readdir } from 'node:fs/promises'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import remark from 'remark'
import visit from 'unist-util-visit'
import is from 'unist-util-is'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/

import { describe, test, expect } from 'vitest'
import { collectCodeListItems } from './collect-code-list-items.mjs'

Expand Down
Loading