feat: add gamemode selector in create world screen. always use creative with ?singleplayer=1

This commit is contained in:
Vitaly Turovsky 2024-05-26 18:58:46 +03:00
commit 0d8beef65c
11 changed files with 56 additions and 50 deletions

View file

@ -6,10 +6,10 @@ const fns = {
async getAlias () {
const aliasesRaw = process.env.ALIASES
if (!aliasesRaw) throw new Error('No aliases found')
const aliases = aliasesRaw.split('\n').map((x) => x.split('='))
const aliases = aliasesRaw.split('\n').map((x) => x.trim().split('='))
const githubActionsPull = process.env.PULL_URL?.split('/').at(-1)
if (!githubActionsPull) throw new Error(`Not a pull request, got ${process.env.GITHUB_REF}`)
const prNumber = githubActionsPull[1]
if (!githubActionsPull) throw new Error(`Not a pull request, got ${process.env.PULL_URL}`)
const prNumber = githubActionsPull
const alias = aliases.find((x) => x[0] === prNumber)
if (alias) {
// set github output
@ -18,7 +18,7 @@ const fns = {
}
}
function setOutput(key, value) {
function setOutput (key, value) {
// Temporary hack until core actions library catches up with github new recommendations
const output = process.env['GITHUB_OUTPUT']
fs.appendFileSync(output, `${key}=${value}${os.EOL}`)