-
Notifications
You must be signed in to change notification settings - Fork 208
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
Check whether extension has an OSI approved license #513
base: master
Are you sure you want to change the base?
Conversation
lib/resolveExtension.js
Outdated
@@ -53,6 +54,26 @@ exports.resolveExtension = async function ({ id, repository, location }, ms) { | |||
await exec(`git clone --filter=blob:none --recurse-submodules ${repository} ${repoPath}`, { quiet: true }); | |||
|
|||
const packagePath = [repoPath, location, 'package.json'].filter(p => !!p).join('/'); | |||
|
|||
//#region Check if the extension has an OSI-approved open-source license | |||
try { |
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.
Should not we check a revision form which we build vsix file?
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.
Great catch, @akosyakov, I was thinking about doing that, settled on "licenses don't change from commit to commit, right?". In edge cases where a license might be changed, added, or removed, I'll integrate it into the resolveVersion
function to avoid otherwise duplicating the code over and over.
publish-extensions/lib/resolveExtension.js
Lines 60 to 71 in 4d65730
async function resolveVersion(ref) { | |
try { | |
await exec(`git reset --hard ${ref} --quiet`, { cwd: repoPath, quiet: true }); | |
const manifest = JSON.parse(await fs.promises.readFile(packagePath, 'utf-8')); | |
if (`${manifest.publisher}.${manifest.name}`.toLowerCase() !== id.toLowerCase()) { | |
return undefined; | |
} | |
return manifest.version; | |
} catch { | |
return undefined; | |
} | |
} |
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.
Just looked into this again, and it seems there is no way to fetch the license for a specific time in the repository, just the current state. I checked with both the REST and GraphQL APIs, the only parameters allowed are name
and owner
.
da64976
to
2baee1c
Compare
Fixes #510
How to test
extensions.json
GITHUB_TOKEN
, so that the script can request the GitHub API for the license)ToDo