-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.sh
executable file
·34 lines (32 loc) · 894 Bytes
/
plugin.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env sh
# test environment variables
if [ -z "${PLUGIN_GITEA_URL}" ]; then
echo "You must provide a Gitea URL"
exit 1
fi
if [ -z "${PLUGIN_GITEA_TOKEN}" ]; then
echo "You must provide a Gitea TOKEN"
exit 1
fi
if [ -z "${PLUGIN_REPOOWNER}" ]; then
echo "You must provide an repo owner"
exit 1
fi
if [ -z "${PLUGIN_REPONAME}" ]; then
echo "You must provide a repo name"
exit 1
fi
if [ -z "${PLUGIN_TITLE}" ]; then
echo "You must provide a issue title"
exit 1
fi
if [ -z "${PLUGIN_COMMENT}" ]; then
echo "You must provide a comment"
exit 1
fi
# create issue
curl -S -s -X 'POST' "${PLUGIN_GITEA_URL}"/api/v1/repos/"${PLUGIN_REPOOWNER}"/"${PLUGIN_REPONAME}"/issues \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: token '"${PLUGIN_GITEA_TOKEN}" \
-d '{ "title": "'"${PLUGIN_TITLE}"'", "body": "'"${PLUGIN_COMMENT}"'" }'