mirror of
https://github.com/octoleo/octosync.git
synced 2025-01-02 20:10:13 +00:00
Fixed the url validation.
This commit is contained in:
parent
cbbfade58a
commit
7bf28ed5ae
23
src/sync.sh
23
src/sync.sh
@ -23,13 +23,20 @@ function main() {
|
|||||||
# the changes into the target repository
|
# the changes into the target repository
|
||||||
if (("$TARGET_REPO_ACTION" == 1)); then
|
if (("$TARGET_REPO_ACTION" == 1)); then
|
||||||
# we must merge directly to target
|
# we must merge directly to target
|
||||||
echo "we merge directly into target... soon"
|
makeMergeToTarget
|
||||||
else
|
else
|
||||||
# we should create a pull request
|
# we should create a pull request
|
||||||
echo "we create a pull request via the github CLI... soon"
|
makePullRequestAgainstTarget
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# merge the changes into the target repository
|
||||||
|
function makeMergeToTarget() {
|
||||||
|
# go into repo folder
|
||||||
|
cd target_repo
|
||||||
|
# make a commit of the changes
|
||||||
|
}
|
||||||
|
|
||||||
# show the configuration values
|
# show the configuration values
|
||||||
function checkConfValues () {
|
function checkConfValues () {
|
||||||
# check if we have found errors
|
# check if we have found errors
|
||||||
@ -37,7 +44,7 @@ function checkConfValues () {
|
|||||||
|
|
||||||
# make sure SOURCE_REPO is set
|
# make sure SOURCE_REPO is set
|
||||||
[[ ! "${SOURCE_REPO}" == *"/"* ]] && echo "SOURCE_REPO:${SOURCE_REPO} is not a repo path!" && ERROR=1
|
[[ ! "${SOURCE_REPO}" == *"/"* ]] && echo "SOURCE_REPO:${SOURCE_REPO} is not a repo path!" && ERROR=1
|
||||||
! wget --spider "https://github.com/${SOURCE_REPO}" 2>/dev/null && \
|
[[ ! `wget -S --spider "https://github.com/${SOURCE_REPO}" 2>&1 | grep 'HTTP/1.1 200 OK'` ]] && \
|
||||||
echo "SOURCE_REPO:https://github.com/${SOURCE_REPO} is not set correctly, or the guthub user does not have access!" && \
|
echo "SOURCE_REPO:https://github.com/${SOURCE_REPO} is not set correctly, or the guthub user does not have access!" && \
|
||||||
ERROR=1
|
ERROR=1
|
||||||
|
|
||||||
@ -49,8 +56,8 @@ function checkConfValues () {
|
|||||||
|
|
||||||
# make sure TARGET_REPO is set
|
# make sure TARGET_REPO is set
|
||||||
[[ ! "${TARGET_REPO}" == *"/"* ]] && echo "TARGET_REPO:${TARGET_REPO} is not a repo path!" && ERROR=1
|
[[ ! "${TARGET_REPO}" == *"/"* ]] && echo "TARGET_REPO:${TARGET_REPO} is not a repo path!" && ERROR=1
|
||||||
! wget --spider "https://github.com/${TARGET_REPO}" 2>/dev/null \
|
[[ ! `wget -S --spider "https://github.com/${TARGET_REPO}" 2>&1 | grep 'HTTP/1.1 200 OK'` ]] && \
|
||||||
&& echo "TARGET_REPO:https://github.com/${TARGET_REPO} is not set correctly, or the guthub user does not have access!" \
|
echo "TARGET_REPO:https://github.com/${TARGET_REPO} is not set correctly, or the guthub user does not have access!" \
|
||||||
&& ERROR=1
|
&& ERROR=1
|
||||||
|
|
||||||
# make sure TARGET_REPO_BRANCH is set
|
# make sure TARGET_REPO_BRANCH is set
|
||||||
@ -446,7 +453,7 @@ while :; do
|
|||||||
--test) # set the test behaviour
|
--test) # set the test behaviour
|
||||||
TEST=1
|
TEST=1
|
||||||
;;
|
;;
|
||||||
--conf) # Takes an option argument; ensure it has been specified.
|
--conf | --config) # Takes an option argument; ensure it has been specified.
|
||||||
if [ "$2" ]; then
|
if [ "$2" ]; then
|
||||||
CONFIG_FILE=$2
|
CONFIG_FILE=$2
|
||||||
shift
|
shift
|
||||||
@ -455,10 +462,10 @@ while :; do
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
--conf=?*)
|
--conf=?* | --config=?*)
|
||||||
CONFIG_FILE=${1#*=} # Delete everything up to "=" and assign the remainder.
|
CONFIG_FILE=${1#*=} # Delete everything up to "=" and assign the remainder.
|
||||||
;;
|
;;
|
||||||
--conf=) # Handle the case of an empty --conf=
|
--conf= | --config) # Handle the case of an empty --conf=
|
||||||
echo 'ERROR: "--conf" requires a non-empty option argument.'
|
echo 'ERROR: "--conf" requires a non-empty option argument.'
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user