xref: /openbsd/gnu/usr.bin/perl/t/porting/authors.t (revision 73471bf0)
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
13find_git_or_skip('all');
14skip_all(
15    "This distro may have modified some files in cpan/. Skipping validation.")
16  if $ENV{'PERL_BUILD_PACKAGING'};
17
18my $revision_range = ''; # could use 'v5.22.0..' as default, no reason to recheck all previous commits...
19if ( $ENV{TRAVIS} && defined $ENV{TRAVIS_COMMIT_RANGE} ) {
20	# travisci is adding a merge commit when smoking a pull request
21	#	unfortunately it's going to use the default GitHub email from the author
22	#	which can differ from the one the author wants to use as part of the pull request
23	#	let's simply use the TRAVIS_COMMIT_RANGE which list the commits we want to check
24	#	all the more a pull request should not be impacted by blead being incorrect
25	$revision_range = $ENV{TRAVIS_COMMIT_RANGE};
26}
27elsif( $ENV{GITHUB_ACTIONS} && length $ENV{GITHUB_BASE_REF} ) {
28    # Same as above, except for GitHub Actions
29    # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables
30
31    # This hardcoded origin/ isn't great, but I'm not sure how to better fix it
32    my $common_ancestor = `git merge-base "origin/$ENV{GITHUB_BASE_REF}" "HEAD~2" 2>/dev/null`;
33
34    chomp($common_ancestor);
35
36    $revision_range = "${common_ancestor}..HEAD" if length $common_ancestor
37}
38
39# This is the subset of "pretty=fuller" that checkAUTHORS.pl actually needs:
40print qx{git log --no-merges --pretty=format:"Author: %an <%ae>" $revision_range | $^X Porting/checkAUTHORS.pl --tap -};
41
42# EOF
43