diff --git a/.github/workflows/headers.yml b/.github/workflows/headers.yml new file mode 100644 index 0000000..8f7486b --- /dev/null +++ b/.github/workflows/headers.yml @@ -0,0 +1,26 @@ +name: Headers + +on: + pull_request: + +permissions: {} + +jobs: + check-headers: + name: Check headers + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java 8 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 8 + + - name: Cache Coursier cache + uses: coursier/cache-action@v6.4.0 + + - name: Check headers + run: sbt +headerCheckAll diff --git a/build.sbt b/build.sbt index 259ff7d..5374b05 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,4 @@ -lazy val `sbt-pull-request-validator` = (project in file(".")) - .enablePlugins(AutomateHeaderPlugin) +lazy val `sbt-pull-request-validator` = project in file(".") sbtPlugin := true enablePlugins(SbtPlugin) @@ -13,7 +12,6 @@ organization := "com.github.sbt" homepage := Some(url("https://github.com/sbt/sbt-pull-request-validator")) licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")) -organizationName := "Hewlett Packard Enterprise" startYear := Some(2018) // https://mvnrepository.com/artifact/org.kohsuke/github-api diff --git a/project/Header.scala b/project/Header.scala new file mode 100644 index 0000000..a4f4978 --- /dev/null +++ b/project/Header.scala @@ -0,0 +1,30 @@ +import sbt._ + +import de.heikoseeberger.sbtheader.HeaderPlugin +import de.heikoseeberger.sbtheader.HeaderPlugin.{ autoImport => SbtHeaderKeys } + +object Header extends AutoPlugin { + override lazy val requires = plugins.JvmPlugin && HeaderPlugin + override lazy val trigger = allRequirements + import SbtHeaderKeys.{ HeaderFileType, HeaderCommentStyle, HeaderLicense } + + override lazy val projectSettings = Seq( + SbtHeaderKeys.headerMappings ++= Map( + HeaderFileType.scala -> HeaderCommentStyle.cStyleBlockComment, + HeaderFileType.java -> HeaderCommentStyle.cStyleBlockComment + ), + SbtHeaderKeys.headerLicense := Some( + HeaderLicense.Custom( + """|Sbt Pull Request Validator + |Copyright Lightbend and Hewlett Packard Enterprise + | + |Licensed under Apache License 2.0 + |SPDX-License-Identifier: Apache-2.0 + | + |See the NOTICE file distributed with this work for + |additional information regarding copyright ownership. + |""".stripMargin + ) + ) + ) +} diff --git a/project/plugins.sbt b/project/plugins.sbt index 5de78b4..9b2a22f 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,6 @@ libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") -addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.0.0") +addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.22.0") diff --git a/src/main/scala/com/github/sbt/pullrequestvalidator/ValidatePullRequest.scala b/src/main/scala/com/github/sbt/pullrequestvalidator/ValidatePullRequest.scala index 690edc6..bff38cb 100644 --- a/src/main/scala/com/github/sbt/pullrequestvalidator/ValidatePullRequest.scala +++ b/src/main/scala/com/github/sbt/pullrequestvalidator/ValidatePullRequest.scala @@ -1,17 +1,12 @@ /* - * Copyright 2018 Hewlett Packard Enterprise + * Sbt Pull Request Validator + * Copyright Lightbend and Hewlett Packard Enterprise * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under Apache License 2.0 + * SPDX-License-Identifier: Apache-2.0 * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. */ package com.github.sbt.pullrequestvalidator diff --git a/src/main/scala/com/hpe/sbt/package.scala b/src/main/scala/com/hpe/sbt/package.scala index a25132b..a0b8c04 100644 --- a/src/main/scala/com/hpe/sbt/package.scala +++ b/src/main/scala/com/hpe/sbt/package.scala @@ -1,3 +1,14 @@ +/* + * Sbt Pull Request Validator + * Copyright Lightbend and Hewlett Packard Enterprise + * + * Licensed under Apache License 2.0 + * SPDX-License-Identifier: Apache-2.0 + * + * See the NOTICE file distributed with this work for + * additional information regarding copyright ownership. + */ + package com.hpe package object sbt {