Skip to content

Instantly share code, notes, and snippets.

@voxpelli
Created October 26, 2021 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save voxpelli/203cd81ee97f0f20cd1ed2a88cbec4fd to your computer and use it in GitHub Desktop.
Save voxpelli/203cd81ee97f0f20cd1ed2a88cbec4fd to your computer and use it in GitHub Desktop.
Takes a Blue Oak Council Copyleft JSON file and outputs it in a format that can be copy and pasted into the GitHub organization insights query https://blueoakcouncil.org/copyleft.json
license:CDDL-1.0
license:CDDL-1.1
license:CPL-1.0
license:EPL-1.0
license:EPL-2.0
license:ErlPL-1.1
license:IPL-1.0
license:LGPL-2.0-only
license:LGPL-2.0-or-later
license:LGPL-2.1-only
license:LGPL-2.1-or-later
license:LGPL-3.0-only
license:LGPL-3.0-or-later
license:MPL-1.0
license:MPL-1.1
license:MPL-2.0
license:MPL-2.0-no-copyleft-exception
license:MS-RL
license:SPL-1.0
license:BSD-Protection
license:copyleft-next-0.3.0
license:copyleft-next-0.3.1
license:GPL-1.0-only
license:GPL-1.0-or-later
license:GPL-2.0-only
license:GPL-2.0-or-later
license:GPL-3.0-only
license:GPL-3.0-or-later
license:QPL-1.0
license:Sleepycat
license:AGPL-1.0-only
license:AGPL-1.0-or-later
license:AGPL-3.0-only
license:AGPL-3.0-or-later
license:APSL-1.0
license:APSL-1.1
license:APSL-1.2
license:APSL-2.0
license:CPAL-1.0
license:EUPL-1.0
license:EUPL-1.1
license:EUPL-1.2
license:NPOSL-3.0
license:OSL-1.0
license:OSL-1.1
license:OSL-2.0
license:OSL-2.1
license:OSL-3.0
license:RPSL-1.0
license:SSPL-1.0
license:CAL-1.0
license:CAL-1.0-Combined-Work-Exception
license:Parity-6.0.0
license:Parity-7.0.0
license:RPL-1.1
license:RPL-1.5
// From https://blueoakcouncil.org/copyleft.json
const blueoakCopyleftJson = {"version":"9","families":{"weak":[{"name":"Common Development and Distribution License","versions":[{"id":"CDDL-1.0","name":"Common Development and Distribution License 1.0","url":"https://spdx.org/licenses/CDDL-1.0.html"},{"id":"CDDL-1.1","name":"Common Development and Distribution License 1.1","url":"https://spdx.org/licenses/CDDL-1.1.html"}]},{"name":"Common Public License","versions":[{"id":"CPL-1.0","name":"Common Public License 1.0","url":"https://spdx.org/licenses/CPL-1.0.html"}]},{"name":"Eclipse Public License","versions":[{"id":"EPL-1.0","name":"Eclipse Public License 1.0","url":"https://spdx.org/licenses/EPL-1.0.html"},{"id":"EPL-2.0","name":"Eclipse Public License 2.0","url":"https://spdx.org/licenses/EPL-2.0.html"}]},{"name":"Erlang Public License","versions":[{"id":"ErlPL-1.1","name":"Erlang Public License v1.1","url":"https://spdx.org/licenses/ErlPL-1.1.html"}]},{"name":"IBM Public License","versions":[{"id":"IPL-1.0","name":"IBM Public License v1.0","url":"https://spdx.org/licenses/IPL-1.0.html"}]},{"name":"GNU Library General Public License","versions":[{"id":"LGPL-2.0-only","name":"GNU Library General Public License v2 only","url":"https://spdx.org/licenses/LGPL-2.0-only.html"},{"id":"LGPL-2.0-or-later","name":"GNU Library General Public License v2 or later","url":"https://spdx.org/licenses/LGPL-2.0-or-later.html"},{"id":"LGPL-2.1-only","name":"GNU Lesser General Public License v2.1 only","url":"https://spdx.org/licenses/LGPL-2.1-only.html"},{"id":"LGPL-2.1-or-later","name":"GNU Lesser General Public License v2.1 or later","url":"https://spdx.org/licenses/LGPL-2.1-or-later.html"},{"id":"LGPL-3.0-only","name":"GNU Lesser General Public License v3.0 only","url":"https://spdx.org/licenses/LGPL-3.0-only.html"},{"id":"LGPL-3.0-or-later","name":"GNU Lesser General Public License v3.0 or later","url":"https://spdx.org/licenses/LGPL-3.0-or-later.html"}]},{"name":"Mozilla Public License","versions":[{"id":"MPL-1.0","name":"Mozilla Public License 1.0","url":"https://spdx.org/licenses/MPL-1.0.html"},{"id":"MPL-1.1","name":"Mozilla Public License 1.1","url":"https://spdx.org/licenses/MPL-1.1.html"},{"id":"MPL-2.0","name":"Mozilla Public License 2.0","url":"https://spdx.org/licenses/MPL-2.0.html"},{"id":"MPL-2.0-no-copyleft-exception","name":"Mozilla Public License 2.0 (no copyleft exception)","url":"https://spdx.org/licenses/MPL-2.0-no-copyleft-exception.html"}]},{"name":"Microsoft Reciprocal License","versions":[{"id":"MS-RL","name":"Microsoft Reciprocal License","url":"https://spdx.org/licenses/MS-RL.html"}]},{"name":"Sun Public License v1.0","versions":[{"id":"SPL-1.0","name":"Sun Public License v1.0","url":"https://spdx.org/licenses/SPL-1.0.html"}]}],"strong":[{"name":"BSD Protection License","versions":[{"id":"BSD-Protection","name":"BSD Protection License","url":"https://spdx.org/licenses/BSD-Protection.html"}]},{"name":"copyleft-next","versions":[{"id":"copyleft-next-0.3.0","name":"copyleft-next 0.3.0","url":"https://spdx.org/licenses/copyleft-next-0.3.0.html"},{"id":"copyleft-next-0.3.1","name":"copyleft-next 0.3.1","url":"https://spdx.org/licenses/copyleft-next-0.3.1.html"}]},{"name":"GNU General Public License","versions":[{"id":"GPL-1.0-only","name":"GNU General Public License v1.0 only","url":"https://spdx.org/licenses/GPL-1.0-only.html"},{"id":"GPL-1.0-or-later","name":"GNU General Public License v1.0 or later","url":"https://spdx.org/licenses/GPL-1.0-or-later.html"},{"id":"GPL-2.0-only","name":"GNU General Public License v2.0 only","url":"https://spdx.org/licenses/GPL-2.0-only.html"},{"id":"GPL-2.0-or-later","name":"GNU General Public License v2.0 or later","url":"https://spdx.org/licenses/GPL-2.0-or-later.html"},{"id":"GPL-3.0-only","name":"GNU General Public License v3.0 only","url":"https://spdx.org/licenses/GPL-3.0-only.html"},{"id":"GPL-3.0-or-later","name":"GNU General Public License v3.0 or later","url":"https://spdx.org/licenses/GPL-3.0-or-later.html"}]},{"name":"Q Public License","versions":[{"id":"QPL-1.0","name":"Q Public License 1.0","url":"https://spdx.org/licenses/QPL-1.0.html"}]},{"name":"Sleepycat License","versions":[{"id":"Sleepycat","name":"Sleepycat License","url":"https://spdx.org/licenses/Sleepycat.html"}]}],"network":[{"name":"Affero General Public License","versions":[{"id":"AGPL-1.0-only","name":"Affero General Public License v1.0 only","url":"https://spdx.org/licenses/AGPL-1.0-only.html"},{"id":"AGPL-1.0-or-later","name":"Affero General Public License v1.0 or later","url":"https://spdx.org/licenses/AGPL-1.0-or-later.html"},{"id":"AGPL-3.0-only","name":"GNU Affero General Public License v3.0 only","url":"https://spdx.org/licenses/AGPL-3.0-only.html"},{"id":"AGPL-3.0-or-later","name":"GNU Affero General Public License v3.0 or later","url":"https://spdx.org/licenses/AGPL-3.0-or-later.html"}]},{"name":"Apple Public Source License","versions":[{"id":"APSL-1.0","name":"Apple Public Source License 1.0","url":"https://spdx.org/licenses/APSL-1.0.html"},{"id":"APSL-1.1","name":"Apple Public Source License 1.1","url":"https://spdx.org/licenses/APSL-1.1.html"},{"id":"APSL-1.2","name":"Apple Public Source License 1.2","url":"https://spdx.org/licenses/APSL-1.2.html"},{"id":"APSL-2.0","name":"Apple Public Source License 2.0","url":"https://spdx.org/licenses/APSL-2.0.html"}]},{"name":"Common Public Attribution License","versions":[{"id":"CPAL-1.0","name":"Common Public Attribution License 1.0","url":"https://spdx.org/licenses/CPAL-1.0.html"}]},{"name":"European Union Public License","versions":[{"id":"EUPL-1.0","name":"European Union Public License 1.0","url":"https://spdx.org/licenses/EUPL-1.0.html"},{"id":"EUPL-1.1","name":"European Union Public License 1.1","url":"https://spdx.org/licenses/EUPL-1.1.html"},{"id":"EUPL-1.2","name":"European Union Public License 1.2","url":"https://spdx.org/licenses/EUPL-1.2.html"}]},{"name":"Non-Profit Open Software License","versions":[{"id":"NPOSL-3.0","name":"Non-Profit Open Software License 3.0","url":"https://spdx.org/licenses/NPOSL-3.0.html"}]},{"name":"Open Software License","versions":[{"id":"OSL-1.0","name":"Open Software License 1.0","url":"https://spdx.org/licenses/OSL-1.0.html"},{"id":"OSL-1.1","name":"Open Software License 1.1","url":"https://spdx.org/licenses/OSL-1.1.html"},{"id":"OSL-2.0","name":"Open Software License 2.0","url":"https://spdx.org/licenses/OSL-2.0.html"},{"id":"OSL-2.1","name":"Open Software License 2.1","url":"https://spdx.org/licenses/OSL-2.1.html"},{"id":"OSL-3.0","name":"Open Software License 3.0","url":"https://spdx.org/licenses/OSL-3.0.html"}]},{"name":"RealNetworks Public Source License","versions":[{"id":"RPSL-1.0","name":"RealNetworks Public Source License v1.0","url":"https://spdx.org/licenses/RPSL-1.0.html"}]},{"name":"Server Side Public License","versions":[{"id":"SSPL-1.0","name":"Server Side Public License Version 1","url":"https://spdx.org/licenses/SSPL-1.0.html"}]}],"maximal":[{"name":"Cryptographic Autonomy License","versions":[{"id":"CAL-1.0","name":"Cryptographic Autonomy License 1.0","url":"https://spdx.org/licenses/CAL-1.0.html"},{"id":"CAL-1.0-Combined-Work-Exception","name":"Cryptographic Autonomy License 1.0 (Combined Work Exception)","url":"https://spdx.org/licenses/CAL-1.0-Combined-Work-Exception.html"}]},{"name":"The Parity Public License","versions":[{"id":"Parity-6.0.0","name":"The Parity Public License 6.0.0","url":"https://spdx.org/licenses/Parity-6.0.0.html"},{"id":"Parity-7.0.0","name":"The Parity Public License 7.0.0","url":"https://spdx.org/licenses/Parity-7.0.0.html"}]},{"name":"Reciprocal Public License","versions":[{"id":"RPL-1.1","name":"Reciprocal Public License 1.1","url":"https://spdx.org/licenses/RPL-1.1.html"},{"id":"RPL-1.5","name":"Reciprocal Public License 1.5","url":"https://spdx.org/licenses/RPL-1.5.html"}]}]}};
for (const family in blueoakCopyleftJson.families) {
if (family === 'weak') continue;
const members = foo.families[family];
for (const license of members) {
for (const version of license.versions) {
console.log('license:' + version.id);
}
}
}
license:BSD-Protection
license:copyleft-next-0.3.0
license:copyleft-next-0.3.1
license:GPL-1.0-only
license:GPL-1.0-or-later
license:GPL-2.0-only
license:GPL-2.0-or-later
license:GPL-3.0-only
license:GPL-3.0-or-later
license:QPL-1.0
license:Sleepycat
license:AGPL-1.0-only
license:AGPL-1.0-or-later
license:AGPL-3.0-only
license:AGPL-3.0-or-later
license:APSL-1.0
license:APSL-1.1
license:APSL-1.2
license:APSL-2.0
license:CPAL-1.0
license:EUPL-1.0
license:EUPL-1.1
license:EUPL-1.2
license:NPOSL-3.0
license:OSL-1.0
license:OSL-1.1
license:OSL-2.0
license:OSL-2.1
license:OSL-3.0
license:RPSL-1.0
license:SSPL-1.0
license:CAL-1.0
license:CAL-1.0-Combined-Work-Exception
license:Parity-6.0.0
license:Parity-7.0.0
license:RPL-1.1
license:RPL-1.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment