xref: /openbsd/gnu/usr.bin/perl/t/porting/authors.t (revision 5486feef)
1#!./perl -w
2# Test that there are no missing authors in AUTHORS
3
4BEGIN {
5    chdir 't' if -d 't';
6    require "./test.pl";
7    set_up_inc('../lib', '..');
8}
9
10use TestInit qw(T);    # T is chdir to the top level
11use strict;
12
13my $source_dir = find_git_or_skip('all');
14
15skip_all(
16    "This distro may have modified some files in cpan/. Skipping validation.")
17  if $ENV{'PERL_BUILD_PACKAGING'};
18
19skip_all(
20    "This is a shallow clone, this test requires history.")
21  if (-e "$source_dir/.git/shallow");
22
23my $revision_range = ''; # could use 'v5.22.0..' as default, no reason to recheck all previous commits...
24if ( $ENV{TRAVIS} && defined $ENV{TRAVIS_COMMIT_RANGE} ) {
25	# travisci is adding a merge commit when smoking a pull request
26	#	unfortunately it's going to use the default GitHub email from the author
27	#	which can differ from the one the author wants to use as part of the pull request
28	#	let's simply use the TRAVIS_COMMIT_RANGE which list the commits we want to check
29	#	all the more a pull request should not be impacted by blead being incorrect
30	$revision_range = $ENV{TRAVIS_COMMIT_RANGE};
31}
32elsif( $ENV{GITHUB_ACTIONS} && length $ENV{GITHUB_BASE_REF} ) {
33    # Same as above, except for GitHub Actions
34    # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables
35
36    # we should be on a merge commit, but double check
37    my $branch_head = `git rev-parse -q --verify "HEAD^2"`;
38    chomp $branch_head;
39
40    # gives the history of the branch being merged, excluding what it is
41    # merged into
42    $revision_range = '"HEAD^1..HEAD^2"'
43        if $branch_head;
44}
45
46exec("$^X Porting/updateAUTHORS.pl --source_dir=$source_dir --validate $revision_range");
47# EOF
48