Skip to content

Commit

Permalink
OPS: Changed copyright action to only check the Yoko files in the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
habiblawal1 committed Jul 12, 2023
1 parent fae7df5 commit f783a02
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,20 @@ jobs:
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Check for correct copyright in all Yoko files
- name: Get changed yoko files
id: changed-files
uses: tj-actions/changed-files@v37
with:
files: yoko*/
files_ignore: yoko*/**/*generated*/**
- name: Check for correct copyright in changed Yoko files
run: |
SRC=$(find yoko*/ -name '*.java')
RC=0
echo "Checking copyright in Yoko src files..."
for filePath in $SRC; do
for filePath in ${{ steps.changed-files.outputs.all_changed_files }}; do
author=$(git log -1 --format="%an" $path)
if [[ $author != *"Alan"* ]]; then
if grep -Eq "Copyright ([[:digit:]]{4}?) IBM Corporation and " $filePath; then
if grep -Eq "Copyright ([[:digit:]]{4}?) IBM Corporation and | Licensed under the Apache License, Version 2\.0" $filePath; then
echo "✅ Copyright OK: $filePath"
else
echo "❌ Copyright not found in $filePath"
Expand Down

0 comments on commit f783a02

Please sign in to comment.