Skip to content

Commit a1e39cc

Browse files
committed
copyright improvement
1 parent 80b50c5 commit a1e39cc

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

.github/workflows/java.yaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ jobs:
1717
- name: Check Copyright
1818
env:
1919
EXTENSIONS: "*.java"
20-
COPYRIGHT_STATEMENT: "/**\n * Copyright IBM Corp. 2016\n */"
20+
BASE_COPYRIGHT: "Copyright IBM Corp. 2016"
2121
run: |
22-
for ext in $EXTENSIONS; do
23-
for file in $(find . -type f -name "$ext" ! -path "cics-java-liberty-link-app/*"); do
24-
if ! grep -q "Copyright" "$file"; then
25-
echo -e "$COPYRIGHT_STATEMENT\n$(cat "$file")" > "$file"
26-
fi
27-
done
22+
for ext in "$EXTENSIONS"; do
23+
for file in $(find . -type f -name "$ext" ! -path "cics-java-liberty-link-app/*"); do
24+
echo "Processing file: $file"
25+
LAST_MODIFIED_YEAR=$(date -r "$file" +"%Y")
26+
27+
if ! grep -q "Copyright" "$file"; then
28+
echo -e "/**\n * $BASE_COPYRIGHT\n */\n$(cat "$file")" > "$file"
29+
elif ! grep -q "$LAST_MODIFIED_YEAR" "$file"; then
30+
sed -i "s/$BASE_COPYRIGHT/$BASE_COPYRIGHT, $LAST_MODIFIED_YEAR/" "$file"
31+
fi
32+
done
2833
done
2934
- name: Create Pull Request
3035
uses: peter-evans/create-pull-request@v7

0 commit comments

Comments
 (0)