diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-06-11 09:55:55 +0800 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-06-11 09:55:55 +0800 |
commit | 37fae048b01a9d9cd82aa9e2e3582d611cd78ae1 (patch) | |
tree | 3d486d1fa3ceba901d57a2594733b63f64e902f9 /.github | |
parent | 0042532eef6e379adb7cbae47bb73f1da4c3e740 (diff) | |
download | Skyblocker-37fae048b01a9d9cd82aa9e2e3582d611cd78ae1.tar.gz Skyblocker-37fae048b01a9d9cd82aa9e2e3582d611cd78ae1.tar.bz2 Skyblocker-37fae048b01a9d9cd82aa9e2e3582d611cd78ae1.zip |
Fix pr commit sha
`process.env.GITHUB_SHA` contains the merge sha for the pr, not the actual latest commit of the pr
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/beta.yml | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 9c93a36d..29690e75 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -20,6 +20,7 @@ on: env: REF_NAME: ${{ github.ref_name }} PR_NUMBER: ${{ github.event.number }} + PR_SHA: ${{ github.event.pull_request.head.sha }} jobs: # This workflow contains a single job called "build" @@ -38,15 +39,19 @@ jobs: result-encoding: string script: | let buildType; + let commitSha; buildType = process.env.REF_NAME === "master" || process.env.REF_NAME === "main" ? "beta" : "alpha"; if (process.env.PR_NUMBER) { buildType += `-pr-${process.env.PR_NUMBER}`; + commitSha = process.env.PR_SHA; + } else { + commitSha = process.env.GITHUB_SHA; } - console.log(`Set build type to ${buildType}.`); + console.log(`Set build type to ${buildType} and commit sha to ${commitSha}`); const fs = require("fs"); let file = fs.readFileSync("./gradle.properties"); - file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-${buildType}-${process.env.GITHUB_SHA.substring(0, 7)}` : e).join("\n"); + file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-${buildType}-${commitSha.substring(0, 7)}` : e).join("\n"); fs.writeFileSync("./gradle.properties", file); - name: Set up JDK 21 |