Skip to content

Commit 9ccbb60

Browse files
committed
Verify release token against repository
1 parent d0976b5 commit 9ccbb60

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ jobs:
3434
# No pipefail: the container's shell is dash, which does not have it, and `make | tee`
3535
# would then report tee's status and a broken build would look clean. Redirecting and
3636
# replaying the log keeps make's own exit status without needing bash.
37-
make ROM=dsi_wifi_manager.dsi DSIWIFI_BUILD_KIND=Release DSIWIFI_COMMIT="${{ github.event.release.tag_name || github.sha }}" > build.log 2>&1 || { cat build.log; echo "::error::build failed"; exit 1; }
37+
release_ref="${{ github.event.release.tag_name }}"
38+
if [ -z "$release_ref" ]; then
39+
release_ref="$(git rev-parse --short=7 HEAD)"
40+
fi
41+
make ROM=dsi_wifi_manager.dsi DSIWIFI_BUILD_KIND=Release DSIWIFI_COMMIT="$release_ref" > build.log 2>&1 || { cat build.log; echo "::error::build failed"; exit 1; }
3842
cat build.log
3943
- name: Check the debug affordances are off
4044
# A Release that still offered the forced write would put a developer affordance in front
@@ -84,15 +88,16 @@ jobs:
8488
# layer takes a runtime flag so the offline harness can draw both variants, so the
8589
# text compiles in either way and only its reachability changes.
8690
env:
87-
TAG: ${{ github.event.release.tag_name || github.sha }}
91+
TAG: ${{ github.event.release.tag_name }}
92+
COMMIT: ${{ github.sha }}
8893
run: |
8994
python3 - <<'EOF'
9095
import os, struct, sys
9196
d = open("dsi_wifi_manager.dsi", "rb").read()
9297
off = struct.unpack("<I", d[0x68:0x6C])[0]
9398
banner = d[off+0x240:off+0x240+256].decode("utf-16-le", "replace").split("\x00")[0]
9499
lines = banner.split("\n")
95-
tag = os.environ["TAG"]
100+
tag = os.environ["TAG"] or os.environ["COMMIT"][:7]
96101
print("banner:", lines)
97102
print("unitcode: 0x%02X" % d[0x12])
98103
bad = []
@@ -112,7 +117,7 @@ jobs:
112117
if: github.event_name == 'workflow_dispatch'
113118
env:
114119
GH_TOKEN: ${{ github.token }}
115-
run: gh api user --jq .login
120+
run: gh api "repos/${{ github.repository }}" --jq .full_name
116121
- name: Upload dsi_wifi_manager.dsi
117122
if: github.event_name == 'release'
118123
env:

0 commit comments

Comments
 (0)