Skip to content

Commit

Permalink
Merge pull request #29 from Meroje/feat/ghes-compat
Browse files Browse the repository at this point in the history
use GITHUB_SERVER/API_URL vars for GHES compatibility
  • Loading branch information
haya14busa committed Nov 9, 2021
2 parents a0d17cd + 6b96c17 commit 1b4d2a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ github.repository }}:$(date +%s)
run: docker build . --file Dockerfile --tag ${GITHUB_REPOSITORY,,}:$(date +%s)
12 changes: 6 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ setup_from_push_event() {
}

list_pulls() {
pulls_endpoint="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls?state=closed&sort=updated&direction=desc"
pulls_endpoint="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/pulls?state=closed&sort=updated&direction=desc"
if [ -n "${INPUT_GITHUB_TOKEN}" ]; then
curl -s -H "Authorization: token ${INPUT_GITHUB_TOKEN}" "${pulls_endpoint}"
else
Expand All @@ -47,7 +47,7 @@ post_pre_status() {
head_label="$(jq -r '.pull_request.head.label' < "${GITHUB_EVENT_PATH}" )"
compare=""
if [ -n "${CURRENT_VERSION}" ]; then
compare="**Changes**:[${CURRENT_VERSION}...${head_label}](https://github.com/${GITHUB_REPOSITORY}/compare/${CURRENT_VERSION}...${head_label})"
compare="**Changes**:[${CURRENT_VERSION}...${head_label}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/${CURRENT_VERSION}...${head_label})"
fi
post_txt="🏷️ [[bumpr]](https://github.com/haya14busa/action-bumpr)
**Next version**:${NEXT_VERSION}
Expand All @@ -63,10 +63,10 @@ ${compare}"
post_post_status() {
compare=""
if [ -n "${CURRENT_VERSION}" ]; then
compare="**Changes**:[${CURRENT_VERSION}...${NEXT_VERSION}](https://github.com/${GITHUB_REPOSITORY}/compare/${CURRENT_VERSION}...${NEXT_VERSION})"
compare="**Changes**:[${CURRENT_VERSION}...${NEXT_VERSION}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/compare/${CURRENT_VERSION}...${NEXT_VERSION})"
fi
post_txt="🚀 [[bumpr]](https://github.com/haya14busa/action-bumpr) [Bumped!](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})
**New version**:[${NEXT_VERSION}](https://github.com/${GITHUB_REPOSITORY}/releases/tag/${NEXT_VERSION})
post_txt="🚀 [[bumpr]](https://github.com/haya14busa/action-bumpr) [Bumped!](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})
**New version**:[${NEXT_VERSION}](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/releases/tag/${NEXT_VERSION})
${compare}
"
post_comment "${post_txt}"
Expand All @@ -76,7 +76,7 @@ ${compare}
# POST /repos/:owner/:repo/issues/:issue_number/comments
post_comment() {
body_text="$1"
endpoint="https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments"
endpoint="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments"
# Do not quote body_text for multiline comments.
body="$(echo ${body_text} | jq -ncR '{body: input}')"
curl -H "Authorization: token ${INPUT_GITHUB_TOKEN}" -d "${body}" "${endpoint}"
Expand Down

0 comments on commit 1b4d2a0

Please sign in to comment.