basename: missing operand
acheong08 opened this issue · 9 comments
/usr/bin/docker run --name ghcriowangyoucao577goreleaseactionv134_78f3d4 --label ea425b --workdir /github/workspace --rm -e "CMD_PATH" -e "APP_VERSION" -e "BUILD_TIME" -e "INPUT_GITHUB_TOKEN" -e "INPUT_GOOS" -e "INPUT_GOARCH" -e "INPUT_PROJECT_PATH" -e "INPUT_BUILD_FLAGS" -e "INPUT_LDFLAGS" -e "INPUT_GOAMD64" -e "INPUT_GOVERSION" -e "INPUT_BINARY_NAME" -e "INPUT_PRE_COMMAND" -e "INPUT_BUILD_COMMAND" -e "INPUT_EXECUTABLE_COMPRESSION" -e "INPUT_EXTRA_FILES" -e "INPUT_MD5SUM" -e "INPUT_SHA256SUM" -e "INPUT_RELEASE_TAG" -e "INPUT_RELEASE_NAME" -e "INPUT_OVERWRITE" -e "INPUT_ASSET_NAME" -e "INPUT_RETRY" -e "INPUT_POST_COMMAND" -e "INPUT_COMPRESS_ASSETS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/ChatGPT-API-server/ChatGPT-API-server":"/github/workspace" ghcr.io/wangyoucao577/go-release-action:v1.34 "***" "linux" "386" "" "-v" "-X \"main.appVersion=\" -X \"main.buildTime=Thu Jan 5 14:22:39 UTC 2023\" -X main.gitCommit=71cf961d8eb2df97f78a0fb3fce2f12a133f0995 -X main.gitRef=" "./" "" "" "go build" "" "" "TRUE" "FALSE" "" "" "FALSE" "" "3" "" "TRUE"
+ source /setup-go.sh
+++ dpkg --print-architecture
++ ARCH=amd64
+++ curl 'https://go.dev/VERSION?m=text'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 8 100 8 0 0 55 0 --:--:-- --:--:-- --:--:-- 56
++ GO_LINUX_PACKAGE_URL=https://go.dev/dl/go1.19.4.linux-amd64.tar.gz
++ [[ '' == \1\.\1\9 ]]
++ [[ '' == \1\.\1\8 ]]
++ [[ '' == \1\.\1\7 ]]
++ [[ '' == \1\.\1\6 ]]
++ [[ '' == \1\.\1\5 ]]
++ [[ '' == \1\.\1\4 ]]
++ [[ '' == \1\.\1\3 ]]
++ [[ '' == http* ]]
++ wget --progress=dot:mega https://go.dev/dl/go1.19.4.linux-amd64.tar.gz -O go-linux.tar.gz
--[20](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:21)23-01-05 14:22:40-- https://go.dev/dl/go1.19.4.linux-amd64.tar.gz
Resolving go.dev (go.dev)... [21](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:22)6.239.38.21, 216.239.36.21, 216.239.32.21, ...
Connecting to go.dev (go.dev)|216.239.38.21|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://dl.google.com/go/go1.19.4.linux-amd64.tar.gz [following]
--2023-01-05 14:[22](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:23):40-- https://dl.google.com/go/go1.19.4.linux-amd64.tar.gz
Resolving dl.google.com (dl.google.com)... 172.253.63.91, 172.253.63.190, 172.253.63.93, ...
Connecting to dl.google.com (dl.google.com)|172.253.63.91|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 148931745 (142M) [application/x-gzip]
Saving to: 'go-linux.tar.gz'
0K ........ ........ ........ ........ ........ ........ 2% 86.7M 2s
3072K ........ ........ ........ ........ ........ ........ 4% 173M 1s
6144K ........ ........ ........ ........ ........ ........ 6% 179M 1s
9216K ........ ........ ........ ........ ........ ........ 8% 179M 1s
12288K ........ ........ ........ ........ ........ ........ 10% 180M 1s
15360K ........ ........ ........ ........ ........ ........ 12% 176M 1s
18432K ........ ........ ........ ........ ........ ........ 14% 182M 1s
21504K ........ ........ ........ ........ ........ ........ 16% 175M 1s
24576K ........ ........ ........ ........ ........ ........ 19% 178M 1s
27648K ........ ........ ........ ........ ........ ........ 21% 178M 1s
30720K ........ ........ ........ ........ ........ ........ [23](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:24)% 175M 1s
33792K ........ ........ ........ ........ ........ ........ 25% 175M 1s
36864K ........ ........ ........ ........ ........ ........ 27% 178M 1s
39936K ........ ........ ........ ........ ........ ........ 29% 176M 1s
43008K ........ ........ ........ ........ ........ ........ 31% 180M 1s
46080K ........ ........ ........ ........ ........ ........ 33% 178M 1s
49152K ........ ........ ........ ........ ........ ........ 35% 177M 1s
522[24](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:25)K ........ ........ ........ ........ ........ ........ 38% 177M 1s
55296K ........ ........ ........ ........ ........ ........ 40% 179M 1s
58368K ........ ........ ........ ........ ........ ........ 42% 175M 0s
61440K ........ ........ ........ ........ ........ ........ 44% 175M 0s
64512K ........ ........ ........ ........ ........ ........ 46% 181M 0s
67584K ........ ........ ........ ........ ........ ........ 48% 174M 0s
70656K ........ ........ ........ ........ ........ ........ 50% 175M 0s
73728K ........ ........ ........ ........ ........ ........ 52% 174M 0s
76800K ........ ........ ........ ........ ........ ........ 54% 171M 0s
79872K ........ ........ ........ ........ ........ ........ 57% 173M 0s
82944K ........ ........ ........ ........ ........ ........ 59% 178M 0s
86016K ........ ........ ........ ........ ........ ........ 61% 176M 0s
89088K ........ ........ ........ ........ ........ ........ 63% 176M 0s
92160K ........ ........ ........ ........ ........ ........ 65% 176M 0s
95232K ........ ........ ........ ........ ........ ........ 67% 174M 0s
98304K ........ ........ ........ ........ ........ ........ 69% 176M 0s
101376K ........ ........ ........ ........ ........ ........ 71% 175M 0s
104448K ........ ........ ........ ........ ........ ........ 73% 176M 0s
107520K ........ ........ ........ ........ ........ ........ 76% 177M 0s
110592K ........ ........ ........ ........ ........ ........ 78% 178M 0s
113664K ........ ........ ........ ........ ........ ........ 80% 178M 0s
116736K ........ ........ ........ ........ ........ ........ 82% 178M 0s
119808K ........ ........ ........ ........ ........ ........ 84% 176M 0s
122880K ........ ........ ........ ........ ........ ........ 86% 174M 0s
1[25](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:26)952K ........ ........ ........ ........ ........ ........ 88% 178M 0s
129024K ........ ........ ........ ........ ........ ........ 90% 179M 0s
132096K ........ ........ ........ ........ ........ ........ 92% 178M 0s
135168K ........ ........ ........ ........ ........ ........ 95% 175M 0s
138240K ........ ........ ........ ........ ........ ........ 97% 176M 0s
141312K ........ ........ ........ ........ ........ ........ 99% 182M 0s
144384K ........ ........ 100% 218M=0.8s
2023-01-05 14:22:41 (173 MB/s) - 'go-linux.tar.gz' saved [148931745/148931745]
++ tar -zxf go-linux.tar.gz
++ mv go /usr/local/
++ mkdir -p /go/bin /go/src /go/pkg
++ export GO_HOME=/usr/local/go
++ GO_HOME=/usr/local/go
++ export GOPATH=/go
++ GOPATH=/go
++ export PATH=/go/bin:/usr/local/go/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
++ PATH=/go/bin:/usr/local/go/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+ go version
go version go1.19.4 linux/amd64
+ env
INPUT_GOARCH=386
INPUT_RETRY=3
INPUT_GOVERSION=
UPX_VER=4.0.0
CMD_PATH=./
HOSTNAME=6371da6c3e3b
GITHUB_REF_NAME=
INPUT_ASSET_NAME=
GITHUB_API_URL=https://api.github.com
INPUT_PROJECT_PATH=./
INPUT_MD5SUM=TRUE
GITHUB_REPOSITORY_OWNER_ID=120765257
GITHUB_STEP_SUMMARY=/github/file_commands/step_summary_f49ca302-6073-437e-bb08-496329ea38ba
GITHUB_RUN_ATTEMPT=2
RUNNER_TOOL_CACHE=/opt/hostedtoolcache
GITHUB_REPOSITORY_OWNER=ChatGPT-Hackers
GITHUB_ACTIONS=true
GITHUB_WORKFLOW_REF=ChatGPT-Hackers/ChatGPT-API-server/.github/workflows/release.yml@71cf961d8eb2df97f78a0fb3fce2f12a133f0995
CI=true
GITHUB_HEAD_REF=
GITHUB_ACTOR=acheong08
GITHUB_ACTION_REF=v1.34
INPUT_OVERWRITE=FALSE
GOPATH=/go
GITHUB_ACTION=__wangyoucao577_go-release-action
INPUT_BINARY_NAME=
GITHUB_REF_PROTECTED=false
INPUT_POST_COMMAND=
INPUT_LDFLAGS=-X "main.appVersion=" -X "main.buildTime=Thu Jan 5 14:22:39 UTC 2023" -X main.gitCommit=71cf961d8eb2df97f78a0fb3fce2f12a133f0995 -X main.gitRef=
***
HOME=/github/home
GITHUB_STATE=/github/file_commands/save_state_f49ca302-6073-437e-bb08-496329ea38ba
INPUT_BUILD_FLAGS=-v
GITHUB_ACTION_REPOSITORY=wangyoucao577/go-release-action
GITHUB_REF_TYPE=branch
RUNNER_TEMP=/home/runner/work/_temp
+ /release.sh
GITHUB_RETENTION_DAYS=90
INPUT_EXTRA_FILES=
INPUT_RELEASE_NAME=
GITHUB_ENV=/github/file_commands/set_env_f49ca302-6073-437e-bb08-496329ea38ba
RUNNER_WORKSPACE=/home/runner/work/ChatGPT-API-server
GITHUB_REF=
GITHUB_SHA=71cf961d8eb2df97f78a0fb3fce2f12a133f0995
GITHUB_REPOSITORY_ID=5799[27](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:28)738
ACTIONS_RUNTIME_TOKEN=***
APP_VERSION=
GITHUB_RUN_ID=3847498139
RUNNER_ARCH=X64
GITHUB_SERVER_URL=https://github.com
GITHUB_ACTOR_ID=36258159
GO_HOME=/usr/local/go
GITHUB_EVENT_PATH=/github/workflow/event.json
INPUT_GOOS=linux
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
BUILD_TIME=Thu Jan 5 14:22:39 UTC 2023
RUNNER_OS=Linux
GITHUB_BASE_REF=
INPUT_SHA256SUM=FALSE
INPUT_BUILD_COMMAND=go build
GITHUB_PATH=/github/file_commands/add_path_f49ca302-6073-437e-bb08-4963[29](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:30)ea38ba
INPUT_RELEASE_TAG=
GITHUB_JOB=releases-matrix
INPUT_COMPRESS_ASSETS=TRUE
RUNNER_NAME=GitHub Actions 3
GITHUB_OUTPUT=/github/file_commands/set_output_f49ca[30](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:31)2-6073-437e-bb08-496[32](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:33)9ea38ba
INPUT_EXECUTABLE_COMPRESSION=
SHLVL=1
GITHUB_REPOSITORY=ChatGPT-Hackers/ChatGPT-API-server
INPUT_PRE_COMMAND=
GITHUB_EVENT_NAME=release
GITHUB_RUN_NUMBER=3
GITHUB_WORKFLOW=Release Go Binaries
PATH=/go/bin:/usr/local/go/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
GITHUB_WORKFLOW_SHA=71cf961d8eb2df97f78a0fb3fce2f12a1[33](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:34)f0995
GITHUB_WORKSPACE=/github/workspace
ACTIONS_RUNTIME_URL=https://pipelines.actions.githubusercontent.com/5vPQH93DZ9WrCNEuGaxWqYjY1h0yKPwEg4pMXAkkLbJIJYIwki/
INPUT_GOAMD[64](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:65)=
GITHUB_TRIGGERING_ACTOR=acheong08
UPLOADER_VER=v0.9.1
ACTIONS_CACHE_URL=https://artifactcache.actions.githubusercontent.com/5vPQH[93](https://github.com/ChatGPT-Hackers/ChatGPT-API-server/actions/runs/3847498139/jobs/6554121071#step:8:94)DZ9WrCNEuGaxWqYjY1h0yKPwEg4pMXAkkLbJIJYIwki/
INPUT_GITHUB_TOKEN=***
_=/usr/bin/env
++ basename ChatGPT-Hackers/ChatGPT-API-server
+ BINARY_NAME=ChatGPT-API-server
+ '[' x '!=' x ']'
++ basename
basename: missing operand
Try 'basename --help' for more information.
+ RELEASE_TAG=
It has succeeded in the past
From the logs, GITHUB_REF=
is empty. How did you trigger the action?
I encountered the same issue when I was using v1.31. Not know why GITHUB_REF=
is empty. It worked in the past, but it broke suddenly.
I upgraded to v1.38 and it's working now. I deleted the release and tag then recreated those to test. Not sure if the issue is fixed as upgrading the version, or it's a transitive github issue.
have the same problem. It's probably related to actions/runner#2788
Repeated use of release tag or release name seems to cause this behavior.
toitlang/toit#1904
This might be a good alternative if the action doesn't provide a ref.
Repeated use of release tag or release name seems to cause this behavior. toitlang/toit#1904 This might be a good alternative if the action doesn't provide a ref.
The workaround looks reasonable, PR is welcome!
Well, I did some tests and referenced https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-single-release.
I think tag_name is RELEASE_TAG, and name is RELEASE_NAME, by replacing these two the issue seems to be resolved.
In the first attempt (action) (A-Start to A-End, jq has no -r parameter).
I only replaced RELEASE_TAG and it failed without changing RELEASE_NAME, so I think this is triggering this issue again ("INPUT_RELEASE_NAME=", but only part of it, because there is a GITHUB_REF, maybe it's because of the spaces).
+ github-assets-uploader -logtostderr -f 'go-testproject-"testrelease-v2"-linux-amd64.tar.gz' -mediatype application/gzip -repo lslqtz/go-testproject -token '-tag="testrelease-v2"' -releasename= -retry 3
E0127 15:23:11.910369 115 err_exit.go:11] tag or releasename is mandatory but not set
In the third attempt (action) (B-Start to B-End), I also replaced RELEASE_NAME. Since github_token was not configured, an unauthenticated error was triggered, but the relevant information was read, so I think this should solve the problem.
But what puzzles me is that the RELEASE_NAME passed here is not wrapped in quotes. I don't know if this is an existing problem or caused by this change.
+ github-assets-uploader -logtostderr -f go-testproject-testrelease-v2-linux-amd64.tar.gz -mediatype application/gzip -repo lslqtz/go-testproject -token -tag=testrelease-v2 -releasename=Test release v2 -retry 3
E0127 15:34:26.943266 120 err_exit.go:11] GET https://api.github.com/repos/lslqtz/go-testproject/releases: 401 Bad credentials []
For testing, I modified it using the following code.
To be honest, I have no confidence in the quality of the code or whether it will work.
B-Start
A-Start
#if [ ! -z "${GITHUB_REF}" ]; then
# RELEASE_TAG=$(basename ${GITHUB_REF})
#else
RELEASE_TAG=$(jq -r '.release.tag_name' ${GITHUB_EVENT_PATH})
#fi
#if [ ! -z "${INPUT_RELEASE_TAG}" ]; then
# RELEASE_TAG=${INPUT_RELEASE_TAG}
#elif [ ! -z "${INPUT_RELEASE_NAME}" ]; then # prevent upload-asset by tag due to github-ref default if a name is given
# RELEASE_TAG=""
#fi
A-End
#if [ ! -z "${INPUT_RELEASE_NAME}" ]; then
# RELEASE_NAME=${INPUT_RELEASE_NAME}
#else
RELEASE_NAME=$(jq -r '.release.name' ${GITHUB_EVENT_PATH})
#fi
B-End
Thanks for the testing! I have added the $(jq -r .release.name ${GITHUB_EVENT_PATH})
as backup if github_ref
is empty. Please try out the latest version.