From 9e60454dc72e09f25566106ad4b391d811618c62 Mon Sep 17 00:00:00 2001 From: Arne Tarara Date: Thu, 13 Jun 2024 21:38:55 +0200 Subject: [PATCH 1/2] api-base is now github.api_url by default --- action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 07b4a590..4e1a84f6 100644 --- a/action.yml +++ b/action.yml @@ -37,7 +37,7 @@ inputs: default: false api-base: description: 'Base URL of the Github API to send data to. Default is api.github.com, but can be changed to your hostname if you have Github Enterprise' - default: 'api.github.com' + default: ${{ github.api_url }} required: false company-uuid: description: 'If you want to add data to the CarbonDB you can set this to your company UUID' @@ -141,7 +141,7 @@ runs: ${{github.action_path}}/scripts/setup.sh setup_python if ${{inputs.send-data}}; then - curl_response=$(curl -s -H "Authorization: Bearer ${{github.token}}" ${{ github.api_url }}/repos/${{ github.repository }}/actions/workflows) + curl_response=$(curl -s -H "Authorization: Bearer ${{github.token}}" ${{ inputs.api-base }}/repos/${{ github.repository }}/actions/workflows) workflow_id=$(echo $curl_response | jq '.workflows[] | select(.name == "${{ github.workflow }}") | .id') ${{github.action_path}}/scripts/vars.sh add_var "WORKFLOW_ID" $workflow_id else @@ -180,7 +180,7 @@ runs: env: PR_NUMBER: ${{ github.event.pull_request.number }} run: | - COMMENTS=$(curl -s -H "Authorization: Bearer ${{github.token}}" "https://${{inputs.api-base}}/repos/${{ github.repository }}/issues/$PR_NUMBER/comments") + COMMENTS=$(curl -s -H "Authorization: Bearer ${{github.token}}" "${{ inputs.api-base }}/repos/${{ github.repository }}/issues/$PR_NUMBER/comments") echo "$COMMENTS" | jq -c --arg username "github-actions[bot]" '.[] | select(.user.login == $username and (.body | index("Eco-CI") // false))' | while read -r comment; do COMMENT_ID=$(echo "$comment" | jq -r '.id') @@ -193,12 +193,12 @@ runs: $INNER_BODY " '{"body": $body}') - curl -s -H "Authorization: Bearer ${{github.token}}" -X PATCH -d "$PAYLOAD" "https://${{inputs.api-base}}/repos/${{ github.repository }}/issues/comments/$COMMENT_ID" + curl -s -H "Authorization: Bearer ${{github.token}}" -X PATCH -d "$PAYLOAD" "${{ inputs.api-base }}/repos/${{ github.repository }}/issues/comments/$COMMENT_ID" echo "Comment $COMMENT_ID collapsed." done NEW_COMMENT=$(cat "/tmp/eco-ci/output-pr.txt" | jq -Rs '.') - API_URL="https://${{inputs.api-base}}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" + API_URL="${{ inputs.api-base }}/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" curl -X POST -H "Authorization: Bearer ${{github.token}}" -d @- $API_URL < Date: Thu, 13 Jun 2024 21:52:19 +0200 Subject: [PATCH 2/2] Updated README [skip ci] --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4e1a84f6..ba426392 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ inputs: description: 'Add a comment to the PR with the results during display-results step' default: false api-base: - description: 'Base URL of the Github API to send data to. Default is api.github.com, but can be changed to your hostname if you have Github Enterprise' + description: 'Base URL of the Github API to send data to (including schema). Default is https://api.github.com, but can be changed to your hostname if you have a custom hosted Github Enterprise' default: ${{ github.api_url }} required: false company-uuid: