Skip to content

Commit

Permalink
test: Add copyright-check workflow
Browse files Browse the repository at this point in the history
Also Use -v flag in CI
  • Loading branch information
richsalz committed Jul 20, 2024
1 parent ccc6f73 commit 95d4bc1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/check-copyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Copyright years
on: [pull_request, push]
permissions:
contents: read

jobs:
copyright-notice:
runs-on: ubuntu-latest
name: Test changed-files
steps:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
- uses: actions/checkout@v4
- name: Check changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: perl ./ietf/check-copyright -lv -f ${ALL_CHANGED_FILES};
11 changes: 7 additions & 4 deletions ietf/check-copyright
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ use warnings;
use POSIX qw/strftime/;
use Getopt::Std;

# Getopt settings.
our($opt_f, $opt_h, $opt_c, $opt_l, $opt_m);

# Number of errors found; exit status
my $ERRORS = 0;

Expand All @@ -18,14 +15,18 @@ my $some_year = "[12][0-9][0-9][0-9]";
my $year_range = "(${some_year})(-${some_year})?";
my $copyright = "Copyright The IETF Trust *${year_range}";

# Getopt settings.
our($opt_h, $opt_f, $opt_v, $opt_c, $opt_l, $opt_m);

sub
usage()
{
my $retcode = pop();

print STDERR "Options:\n";
print STDERR " -f Read filenames from argv\n";
print STDERR " -h This help message\n";
print STDERR " -f Read filenames from argv\n";
print STDERR " -v List files as processed\n";
print STDERR " -c Modify files that should be changed\n";
print STDERR " (Does not do a git commit)\n";
print STDERR " -l List files that need to be changed\n";
Expand Down Expand Up @@ -66,6 +67,8 @@ process()
my $changed = 0;
my $SAVE;

print "# Processing $NAME\n" if defined $opt_v;

# ignore ZIP files
return if $NAME =~ /\.zip/;

Expand Down

0 comments on commit 95d4bc1

Please sign in to comment.