Skip to content

Commit da72239

Browse files
authored
Merge pull request #29 from mdedetrich/add-header-to-new-file
Fix project source file headers
2 parents 472eff4 + 6f4abc3 commit da72239

File tree

5 files changed

+74
-14
lines changed

5 files changed

+74
-14
lines changed

.github/workflows/headers.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Headers
2+
3+
on:
4+
pull_request:
5+
6+
permissions: {}
7+
8+
jobs:
9+
check-headers:
10+
name: Check headers
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Java 8
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: temurin
20+
java-version: 8
21+
22+
- name: Cache Coursier cache
23+
uses: coursier/cache-action@v6.4.0
24+
25+
- name: Check headers
26+
run: sbt +headerCheckAll

build.sbt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
lazy val `sbt-pull-request-validator` = (project in file("."))
2-
.enablePlugins(AutomateHeaderPlugin)
1+
lazy val `sbt-pull-request-validator` = project in file(".")
32

43
sbtPlugin := true
54
enablePlugins(SbtPlugin)
@@ -13,7 +12,6 @@ organization := "com.github.sbt"
1312
homepage := Some(url("https://github.com/sbt/sbt-pull-request-validator"))
1413
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
1514

16-
organizationName := "Hewlett Packard Enterprise"
1715
startYear := Some(2018)
1816

1917
// https://mvnrepository.com/artifact/org.kohsuke/github-api

project/Header.scala

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sbt._
2+
3+
import de.heikoseeberger.sbtheader.HeaderPlugin
4+
import de.heikoseeberger.sbtheader.HeaderPlugin.{ autoImport => SbtHeaderKeys }
5+
6+
object Header extends AutoPlugin {
7+
override lazy val requires = plugins.JvmPlugin && HeaderPlugin
8+
override lazy val trigger = allRequirements
9+
import SbtHeaderKeys.{ HeaderFileType, HeaderCommentStyle, HeaderLicense }
10+
11+
override lazy val projectSettings = Seq(
12+
SbtHeaderKeys.headerMappings ++= Map(
13+
HeaderFileType.scala -> HeaderCommentStyle.cStyleBlockComment,
14+
HeaderFileType.java -> HeaderCommentStyle.cStyleBlockComment
15+
),
16+
SbtHeaderKeys.headerLicense := Some(
17+
HeaderLicense.Custom(
18+
"""|Sbt Pull Request Validator
19+
|Copyright Lightbend and Hewlett Packard Enterprise
20+
|
21+
|Licensed under Apache License 2.0
22+
|SPDX-License-Identifier: Apache-2.0
23+
|
24+
|See the NOTICE file distributed with this work for
25+
|additional information regarding copyright ownership.
26+
|""".stripMargin
27+
)
28+
)
29+
)
30+
}

src/main/scala/com/github/sbt/pullrequestvalidator/ValidatePullRequest.scala

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
/*
2-
* Copyright 2018 Hewlett Packard Enterprise
2+
* Sbt Pull Request Validator
3+
* Copyright Lightbend and Hewlett Packard Enterprise
34
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
5+
* Licensed under Apache License 2.0
6+
* SPDX-License-Identifier: Apache-2.0
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
8+
* See the NOTICE file distributed with this work for
9+
* additional information regarding copyright ownership.
1510
*/
1611

1712
package com.github.sbt.pullrequestvalidator

src/main/scala/com/hpe/sbt/package.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/*
2+
* Sbt Pull Request Validator
3+
* Copyright Lightbend and Hewlett Packard Enterprise
4+
*
5+
* Licensed under Apache License 2.0
6+
* SPDX-License-Identifier: Apache-2.0
7+
*
8+
* See the NOTICE file distributed with this work for
9+
* additional information regarding copyright ownership.
10+
*/
11+
112
package com.hpe
213

314
package object sbt {

0 commit comments

Comments
 (0)