File tree 3 files changed +5
-7
lines changed
3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -38,15 +38,13 @@ jobs:
38
38
DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
39
39
DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
40
40
OPENGROK_REPO_SLUG : ${{ github.repository }}
41
- OPENGROK_PULL_REQUEST : ${{ github.head_ref }}
42
41
OPENGROK_REF : ${{ github.ref }}
43
42
run : ./dev/docker.sh
44
43
- name : Install Python pre-requisites
45
44
run : python3 -m pip install requests
46
45
- name : Optionally update README on Docker hub
47
46
env :
48
47
OPENGROK_REPO_SLUG : ${{ github.repository }}
49
- OPENGROK_PULL_REQUEST : ${{ github.head_ref }}
50
48
DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
51
49
DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
52
50
run : ./dev/dockerhub_readme.py
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ docker run -d $IMAGE
62
62
docker ps -a
63
63
64
64
# This can only work on home repository since it needs encrypted variables.
65
- if [[ -n " $OPENGROK_PULL_REQUEST " ]]; then
65
+ if [[ " $GITHUB_EVENT_NAME " == " pull_request " ]]; then
66
66
echo " Not pushing Docker image for pull requests"
67
67
exit 0
68
68
fi
75
75
76
76
if [[ -z $DOCKER_USERNAME ]]; then
77
77
echo " DOCKER_USERNAME is empty, exiting"
78
- exit 0
78
+ exit 1
79
79
fi
80
80
81
81
if [[ -z $DOCKER_PASSWORD ]]; then
82
82
echo " DOCKER_PASSWORD is empty, exiting"
83
- exit 0
83
+ exit 1
84
84
fi
85
85
86
86
# Publish the image to Docker hub.
Original file line number Diff line number Diff line change @@ -85,8 +85,8 @@ def check_push_env():
85
85
logger .info ("Not updating Docker hub README for non main repo" )
86
86
sys .exit (0 )
87
87
88
- pull_request = os .environ .get ("OPENGROK_PULL_REQUEST " )
89
- if pull_request and len ( pull_request ) > 0 :
88
+ event_type = os .environ .get ("GITHUB_EVENT_NAME " )
89
+ if event_type and event_type == "pull_request" :
90
90
logger .info ("Not updating Docker hub README for pull requests" )
91
91
sys .exit (0 )
92
92
You can’t perform that action at this time.
0 commit comments