-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: look up a hash by version #90
base: main
Are you sure you want to change the base?
Conversation
Fixes mheap#83 Signed-off-by: Lucas Gonze <[email protected]>
.parse(process.argv); | ||
|
||
const filename = program.args[0]; | ||
const filename = program.args[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run npm run lint-fix
to ensure that formatting is correct
[onlyOwner,onlyRepo] = parts; | ||
|
||
parts = onlyRepo.split("@"); | ||
if( 2 == parts.length ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parts.length == 2
here please, we don't use yoda conditions anywhere else
} | ||
[onlyOwner,onlyRepo] = parts; | ||
|
||
parts = onlyRepo.split("@"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable shadowing here. Could we use a more descriptive (and different) variable name?
debug = log.extend("find-ref-on-github"); | ||
return new Promise(async function (resolve, reject) { | ||
const owner = action.owner; | ||
const repo = action.repo; | ||
const pinned = action.pinnedVersion; | ||
const pinned = onlyVersion ? onlyVersion : action.pinnedVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a test in findRefOnGitHub.test.js
that covers this change?
@@ -33,9 +36,24 @@ module.exports = async function ( | |||
continue; | |||
} | |||
|
|||
if (onlyOwner && actions[i].owner !== onlyOwner ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please extract this in to another file (e.g. checkSelectOnly.js
) and write unit tests.
Example module: https://github.com/mheap/pin-github-action/blob/main/checkAllowedRepos.js
Example tests: https://github.com/mheap/pin-github-action/blob/main/checkIgnoredRepos.test.js
continue; | ||
} | ||
|
||
if (onlyRepo && onlyRepo !== "*" && actions[i].repo !== onlyRepo ){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than checking *
explicitly, use matcher
like the existing functionality
@lucasgonze Added a few comments. Please also update the README with usage instructions |
FYI I have not forgotten this. I have made progress but am mainly on vacation so don't anticipate finishing until after I get back in 2-3 weeks. |
Fixes #83
Signed-off-by: Lucas Gonze [email protected]