Skip to content

Commit

Permalink
Merge pull request #23 from thalleslmF/pr-144
Browse files Browse the repository at this point in the history
Pr 144
  • Loading branch information
thalleslmF authored Jul 29, 2021
2 parents 99ba780 + b6e330c commit 6d37648
Show file tree
Hide file tree
Showing 27 changed files with 1,512 additions and 39 deletions.
13 changes: 6 additions & 7 deletions licence.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const core = require('@actions/core')
const github = require('@actions/github')
const fs = require("fs");
const util = require("util");
const chalk = require('chalk')
const chalk = require("chalk");
function hasCorrectCopyrightDate(copyrightFile, status, startDateLicense) {
let requiredDate = ''
if (status === 'modified'){
Expand Down Expand Up @@ -57,17 +57,16 @@ async function checkLicenseFile(file, config, fd) {
)

if (!allCopyrightIncluded) {
console.log('File ' + chalk.yellow(file.name) + chalk.red(': No copyright header!'))
console.log('File '+chalk.yellow(file.name+": ") + chalk.red('No copyright header!'))
reject(file.name)
} else {

const correctDate = hasCorrectCopyrightDate(copyrightFile, file.status, config.startDateLicense)
if (correctDate) {
console.log('File ' + chalk.yellow(file.name) + chalk.green(': ok!'))
console.log(`File ${file.name} :ok!`)
console.log('File ' + chalk.yellow(file.name+": ") + chalk.green('ok!'))
resolve()
} else {
console.log(`file ${file.name}: Fix copyright date!`)
console.log('File '+ chalk.yellow(file.name+": ")+ chalk.red('Fix copyright date!'))
reject(file.name)
}
}
Expand Down Expand Up @@ -103,8 +102,8 @@ const checkLicense = async (fileNames, config) => {
const token = core.getInput('token')
const octokit = github.getOctokit(token)
const prNumber = github.context.payload.pull_request.number
const owner = github.context.payload.repository.owner.login
const repo = github.context.payload.repository.name
const owner = github.context.payload.repository.owner.login
const repo = github.context.payload.repository.name
const responsePr = await octokit.request('GET /repos/{owner}/{repo}/pulls/{pull_number}', ({
owner: owner,
repo: repo,
Expand Down
3 changes: 1 addition & 2 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

const { checkLicense } = require("./licence");
const core = require('@actions/core')
const util = require("util")
const chalk = require('chalk')
fs = require('fs');
glob = require('glob')
Expand All @@ -16,7 +15,7 @@ glob(
const error = await checkLicense(fileNames, { copyrightContent: copyrightContent, startDateLicense: startDateLicense })
if(error) {
console.log(chalk.red(error.title))
console.log(chalk.red(error.message))
console.log(chalk.red(error.details))
core.setFailed('Action failed');
}
}
Expand Down
25 changes: 25 additions & 0 deletions node_modules/colors/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

221 changes: 221 additions & 0 deletions node_modules/colors/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 82 additions & 0 deletions node_modules/colors/examples/normal-usage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6d37648

Please sign in to comment.