Skip to content

Commit

Permalink
Merge branch 'main' into feature/hozlucas28-automated-pull-request-ch…
Browse files Browse the repository at this point in the history
…ecks
  • Loading branch information
hozlucas28 committed Jan 26, 2024
2 parents e049e1b + f323ce3 commit a1d76b1
Show file tree
Hide file tree
Showing 897 changed files with 114,423 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/actions/pull-requests/check-committed-file/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ---------------------------------------------------------------------------- #
# NODE #
# ---------------------------------------------------------------------------- #

# ------------------------------- Dependencies ------------------------------- #

node_modules/
23 changes: 23 additions & 0 deletions .github/actions/pull-requests/check-committed-file/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
author: 'hozlucas28'

name: 'Check committed file'
description: 'Check if the committed file of a pull request is valid'

runs:
using: 'node20'
main: 'main.js'

inputs:
author:
description: 'Name of the user who created the pull request'
required: true
committed-file:
description: 'Committed file of the pull request'
required: true
title:
description: 'Title of the pull request'
required: true
log01:
required: true
log02:
required: true

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions .github/actions/pull-requests/check-committed-file/dist/licenses.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
@actions/core
MIT
The MIT License (MIT)

Copyright 2019 GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@actions/http-client
MIT
Actions Http Client for Node.js

Copyright (c) GitHub, Inc.

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


@fastify/busboy
MIT
Copyright Brian White. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

tunnel
MIT
The MIT License (MIT)

Copyright (c) 2012 Koichi Kobayashi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


undici
MIT
MIT License

Copyright (c) Matteo Collina and Undici contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


uuid
MIT
The MIT License (MIT)

Copyright (c) 2010-2020 Robert Kieffer and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
67 changes: 67 additions & 0 deletions .github/actions/pull-requests/check-committed-file/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { debug, getInput, setFailed } from '@actions/core'
import * as path from 'node:path'
import { getChallengeFolder, getProgrammingLanguageExtension, wrapperChallengesFolder } from '../../utils.mjs'

// Inputs
const author = getInput('author')
const committedFile = getInput('committed-file')
const title = getInput('title')
debug(`'author' (input): ${author}`)
debug(`'committed-file' (input): ${committedFile}`)
debug(`'title' (input): ${title}`)

// Required data
const titleProps = {
challenge: title.slice(1, 3),
language: title.slice(6).toLowerCase(),
}
debug(`Title properties: ${JSON.stringify(titleProps)}`)

const challengeFolder = getChallengeFolder(titleProps.challenge)
const committedFileProps = path.parse(committedFile)
committedFileProps.dir = path.normalize(committedFileProps.dir)
debug(`Folder name of the programming language: ${challengeFolder}`)
debug(`Committed file properties: ${JSON.stringify(committedFileProps)}`)

// Check if directory is valid
const expectedDirectory = path.join(wrapperChallengesFolder, challengeFolder, titleProps.language)
const isValidDirectory = committedFileProps.dir === expectedDirectory
debug(`Expected directory: ${expectedDirectory}`)
debug(`Is valid directory? ${isValidDirectory}`)

if (!isValidDirectory) {
setFailed(
"Directory of committed file doesn't match with the challenge and programming language of the pull request title. " +
'Please check the directory of committed file of the pull request. ' +
`It should be: '${expectedDirectory}'. ` +
'If you think this is an error, please contact an administrator.'
)
}

// Check if file name is valid
const isValidFileName = committedFileProps.name === author
debug(`Is valid file name? ${isValidFileName}`)

if (!isValidFileName) {
setFailed(
"File name of committed file doesn't match with the author name. " +
'Please check the file name of committed file of the pull request. ' +
`It should be: '${author}'. ` +
'If you think this is an error, please contact an administrator.'
)
}

// Check if file extension is valid
const expectedFileExtension = getProgrammingLanguageExtension(titleProps.language)
const isValidFileExtension = committedFileProps.ext === expectedFileExtension
debug(`Expected file extension: ${expectedFileExtension}`)
debug(`Is valid file extension? ${isValidFileExtension}`)

if (!isValidFileExtension) {
setFailed(
"File extension of committed file doesn't match with the programming language name of the pull request title. " +
'Please check the file extension name of committed file of the pull request. ' +
`It should be: '${expectedFileExtension}'. ` +
'If you think this is an error, please contact an administrator.'
)
}

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

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

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

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

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

Loading

0 comments on commit a1d76b1

Please sign in to comment.