Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasticFiasco committed Jul 18, 2020
1 parent bb8551b commit a2e35ba
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

## [Unreleased]

## [1.2.0] - 2020-07-18

### :zap: Added

- Support for GNU Affero General Public License v3.0 only (AGPL-3.0-only) licenses
Expand Down
33 changes: 23 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9530,18 +9530,23 @@ module.exports = {
/***/ 890:
/***/ (function(module) {

// Regular expressions finding the copyright year(s) in Apache 2.0 license files
const APACHE_COPYRIGHT_YEAR = /(Copyright )(\d{4})( \w+)/gm;
const APACHE_COPYRIGHT_YEAR_RANGE = /(Copyright )(\d{4})-(\d{4})( \w+)/gm;
// Regular expressions finding the copyright year(s) in GNU Affero General Public License v3.0 only
// (AGPL-3.0-only) license files
const GNU_AGPLv3_COPYRIGHT_YEAR = /(Copyright\s+\(C\)\s+)(\d{4})(?!\s+Free Software Foundation)(\s+\w+)/gm;
const GNU_AGPLv3_COPYRIGHT_YEAR_RANGE = /(Copyright\s+\(C\)\s+)(\d{4})-(\d{4})(?!\s+Free Software Foundation)(\s+\w+)/gm;

// Regular expressions finding the copyright year(s) in BSD 2-clause "Simplified" and
// BSD 3-clause "New" or "Revised" license files
const BSD_COPYRIGHT_YEAR = /(Copyright \(c\) )(\d{4})(, \w+)/gm;
const BSD_COPYRIGHT_YEAR_RANGE = /(Copyright \(c\) )(\d{4})-(\d{4})(, \w+)/gm;
// Regular expressions finding the copyright year(s) in Apache 2.0 (Apache-2.0) license files
const APACHE_COPYRIGHT_YEAR = /(Copyright\s+)(\d{4})(\s+\w+)/gm;
const APACHE_COPYRIGHT_YEAR_RANGE = /(Copyright\s+)(\d{4})-(\d{4})(\s+\w+)/gm;

// Regular expressions finding the copyright year(s) in MIT license files
const MIT_COPYRIGHT_YEAR = /(Copyright \(c\) )(\d{4})( \w+)/gm;
const MIT_COPYRIGHT_YEAR_RANGE = /(Copyright \(c\) )(\d{4})-(\d{4})( \w+)/gm;
// Regular expressions finding the copyright year(s) in BSD 2-clause "Simplified" (BSD-2-Clause)
// and BSD 3-clause "New" or "Revised" (BSD-3-Clause) license files
const BSD_COPYRIGHT_YEAR = /(Copyright\s+\(c\)\s+)(\d{4})(,\s+\w+)/gm;
const BSD_COPYRIGHT_YEAR_RANGE = /(Copyright\s+\(c\)\s+)(\d{4})-(\d{4})(,\s+\w+)/gm;

// Regular expressions finding the copyright year(s) in MIT (MIT) license files
const MIT_COPYRIGHT_YEAR = /(Copyright\s+\(c\)\s+)(\d{4})(\s+\w+)/gm;
const MIT_COPYRIGHT_YEAR_RANGE = /(Copyright\s+\(c\)\s+)(\d{4})-(\d{4})(\s+\w+)/gm;

/**
* @param {string} license
Expand All @@ -9556,6 +9561,14 @@ function updateLicense(license) {
* @param {number} year
*/
function updateLicenseToYear(license, year) {
// GNU Affero General Public License v3.0 only
if (GNU_AGPLv3_COPYRIGHT_YEAR.test(license)) {
return license.replace(GNU_AGPLv3_COPYRIGHT_YEAR, `$1$2-${year}$3`);
}
if (GNU_AGPLv3_COPYRIGHT_YEAR_RANGE.test(license)) {
return license.replace(GNU_AGPLv3_COPYRIGHT_YEAR_RANGE, `$1$2-${year}$4`);
}

// Apache 2.0
if (APACHE_COPYRIGHT_YEAR.test(license)) {
return license.replace(APACHE_COPYRIGHT_YEAR, `$1$2-${year}$3`);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "action-update-license-year",
"version": "1.1.3",
"version": "1.2.0",
"description": "GitHub Action that in a pull request updates the copyright year(s) in your license file.",
"keywords": [
"github",
Expand Down

0 comments on commit a2e35ba

Please sign in to comment.