Skip to content

Commit a1d76b1

Browse files
authored
Merge branch 'main' into feature/hozlucas28-automated-pull-request-checks
2 parents e049e1b + f323ce3 commit a1d76b1

File tree

897 files changed

+114423
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

897 files changed

+114423
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# ---------------------------------------------------------------------------- #
2+
# NODE #
3+
# ---------------------------------------------------------------------------- #
4+
5+
# ------------------------------- Dependencies ------------------------------- #
6+
7+
node_modules/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
author: 'hozlucas28'
2+
3+
name: 'Check committed file'
4+
description: 'Check if the committed file of a pull request is valid'
5+
6+
runs:
7+
using: 'node20'
8+
main: 'main.js'
9+
10+
inputs:
11+
author:
12+
description: 'Name of the user who created the pull request'
13+
required: true
14+
committed-file:
15+
description: 'Committed file of the pull request'
16+
required: true
17+
title:
18+
description: 'Title of the pull request'
19+
required: true
20+
log01:
21+
required: true
22+
log02:
23+
required: true

.github/actions/pull-requests/check-committed-file/dist/index.js

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
@actions/core
2+
MIT
3+
The MIT License (MIT)
4+
5+
Copyright 2019 GitHub
6+
7+
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:
8+
9+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10+
11+
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.
12+
13+
@actions/http-client
14+
MIT
15+
Actions Http Client for Node.js
16+
17+
Copyright (c) GitHub, Inc.
18+
19+
All rights reserved.
20+
21+
MIT License
22+
23+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
24+
associated documentation files (the "Software"), to deal in the Software without restriction,
25+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
26+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
27+
subject to the following conditions:
28+
29+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
30+
31+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
32+
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
33+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
34+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
35+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36+
37+
38+
@fastify/busboy
39+
MIT
40+
Copyright Brian White. All rights reserved.
41+
42+
Permission is hereby granted, free of charge, to any person obtaining a copy
43+
of this software and associated documentation files (the "Software"), to
44+
deal in the Software without restriction, including without limitation the
45+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
46+
sell copies of the Software, and to permit persons to whom the Software is
47+
furnished to do so, subject to the following conditions:
48+
49+
The above copyright notice and this permission notice shall be included in
50+
all copies or substantial portions of the Software.
51+
52+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
57+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
58+
IN THE SOFTWARE.
59+
60+
tunnel
61+
MIT
62+
The MIT License (MIT)
63+
64+
Copyright (c) 2012 Koichi Kobayashi
65+
66+
Permission is hereby granted, free of charge, to any person obtaining a copy
67+
of this software and associated documentation files (the "Software"), to deal
68+
in the Software without restriction, including without limitation the rights
69+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
70+
copies of the Software, and to permit persons to whom the Software is
71+
furnished to do so, subject to the following conditions:
72+
73+
The above copyright notice and this permission notice shall be included in
74+
all copies or substantial portions of the Software.
75+
76+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
77+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
78+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
79+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
80+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
81+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
82+
THE SOFTWARE.
83+
84+
85+
undici
86+
MIT
87+
MIT License
88+
89+
Copyright (c) Matteo Collina and Undici contributors
90+
91+
Permission is hereby granted, free of charge, to any person obtaining a copy
92+
of this software and associated documentation files (the "Software"), to deal
93+
in the Software without restriction, including without limitation the rights
94+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
95+
copies of the Software, and to permit persons to whom the Software is
96+
furnished to do so, subject to the following conditions:
97+
98+
The above copyright notice and this permission notice shall be included in all
99+
copies or substantial portions of the Software.
100+
101+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
102+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
103+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
104+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
105+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
106+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
107+
SOFTWARE.
108+
109+
110+
uuid
111+
MIT
112+
The MIT License (MIT)
113+
114+
Copyright (c) 2010-2020 Robert Kieffer and other contributors
115+
116+
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:
117+
118+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
119+
120+
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 numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { debug, getInput, setFailed } from '@actions/core'
2+
import * as path from 'node:path'
3+
import { getChallengeFolder, getProgrammingLanguageExtension, wrapperChallengesFolder } from '../../utils.mjs'
4+
5+
// Inputs
6+
const author = getInput('author')
7+
const committedFile = getInput('committed-file')
8+
const title = getInput('title')
9+
debug(`'author' (input): ${author}`)
10+
debug(`'committed-file' (input): ${committedFile}`)
11+
debug(`'title' (input): ${title}`)
12+
13+
// Required data
14+
const titleProps = {
15+
challenge: title.slice(1, 3),
16+
language: title.slice(6).toLowerCase(),
17+
}
18+
debug(`Title properties: ${JSON.stringify(titleProps)}`)
19+
20+
const challengeFolder = getChallengeFolder(titleProps.challenge)
21+
const committedFileProps = path.parse(committedFile)
22+
committedFileProps.dir = path.normalize(committedFileProps.dir)
23+
debug(`Folder name of the programming language: ${challengeFolder}`)
24+
debug(`Committed file properties: ${JSON.stringify(committedFileProps)}`)
25+
26+
// Check if directory is valid
27+
const expectedDirectory = path.join(wrapperChallengesFolder, challengeFolder, titleProps.language)
28+
const isValidDirectory = committedFileProps.dir === expectedDirectory
29+
debug(`Expected directory: ${expectedDirectory}`)
30+
debug(`Is valid directory? ${isValidDirectory}`)
31+
32+
if (!isValidDirectory) {
33+
setFailed(
34+
"Directory of committed file doesn't match with the challenge and programming language of the pull request title. " +
35+
'Please check the directory of committed file of the pull request. ' +
36+
`It should be: '${expectedDirectory}'. ` +
37+
'If you think this is an error, please contact an administrator.'
38+
)
39+
}
40+
41+
// Check if file name is valid
42+
const isValidFileName = committedFileProps.name === author
43+
debug(`Is valid file name? ${isValidFileName}`)
44+
45+
if (!isValidFileName) {
46+
setFailed(
47+
"File name of committed file doesn't match with the author name. " +
48+
'Please check the file name of committed file of the pull request. ' +
49+
`It should be: '${author}'. ` +
50+
'If you think this is an error, please contact an administrator.'
51+
)
52+
}
53+
54+
// Check if file extension is valid
55+
const expectedFileExtension = getProgrammingLanguageExtension(titleProps.language)
56+
const isValidFileExtension = committedFileProps.ext === expectedFileExtension
57+
debug(`Expected file extension: ${expectedFileExtension}`)
58+
debug(`Is valid file extension? ${isValidFileExtension}`)
59+
60+
if (!isValidFileExtension) {
61+
setFailed(
62+
"File extension of committed file doesn't match with the programming language name of the pull request title. " +
63+
'Please check the file extension name of committed file of the pull request. ' +
64+
`It should be: '${expectedFileExtension}'. ` +
65+
'If you think this is an error, please contact an administrator.'
66+
)
67+
}

.github/actions/pull-requests/check-committed-file/node_modules/.bin/uuid

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/pull-requests/check-committed-file/node_modules/.bin/uuid.cmd

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/pull-requests/check-committed-file/node_modules/.bin/uuid.ps1

+28
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/pull-requests/check-committed-file/node_modules/.package-lock.json

+55
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/pull-requests/check-committed-file/node_modules/@actions/core/LICENSE.md

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)