Skip to content

Commit

Permalink
Add outputs for API token and base URL
Browse files Browse the repository at this point in the history
  • Loading branch information
poikilotherm committed Sep 24, 2023
1 parent 0a133d7 commit 3ffb1c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
- name: "Checkout"
uses: "actions/checkout@v4"
- name: Run Dataverse Action
id: dataverse
uses: ./
with:
postgresql_version: 15
Expand All @@ -19,5 +20,7 @@ jobs:
create-dv: true
- name: Check Dataverse Setup
run: |
echo "api_token=${{ steps.dataverse.outputs.api_token }}"
echo "base_url=${{ steps.dataverse.outputs.base_url }}"
echo $(curl http://localhost:8080/api/info/version) && \
echo $(curl http://localhost:8080/api/metadatablocks)
16 changes: 14 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ inputs:
description: "Whether or not to create an example Dataverse"
required: true
default: "true"
outputs:
api_token:
description: "API Token of dataverseAdmin superuser"
value: ${{ steps.bootstrap.outputs.API_TOKEN }}
base_url:
description: "Base URL where to reach the instance via HTTP"
value: ${{ steps.bootstrap.outputs.base_url }}
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -78,16 +85,21 @@ runs:
echo "::endgroup::"
# Bootstrap will wait up until accessible, so blocking here.
- name: "Bootstrap Dataverse service"
id: bootstrap
shell: bash
run: |
echo "::group::🤖 Bootstrap Dataverse service"
mkdir -p "${RUNNER_TEMP}/dv"
touch "${RUNNER_TEMP}/dv/bootstrap.exposed.env"
docker run -i --network apitest_dataverse \
-v "${RUNNER_TEMP}/dv/bootstrap.exposed.env:/.env" \
"${CONFIGBAKER_IMAGE}" bootstrap.sh -e /.env dev
echo "Exposed bootstrap results:"
cat "${RUNNER_TEMP}/dv/bootstrap.exposed.env"
# Expose outputs
grep "API_TOKEN" "${RUNNER_TEMP}/dv/bootstrap.exposed.env" >> "$GITHUB_OUTPUT"
echo "base_url=http://localhost:8080/" >> "$GITHUB_OUTPUT"
echo "::endgroup::"
- name: Retrieve API Token
run: ${{ github.action_path }}/scripts/get_api_token.sh
Expand Down

0 comments on commit 3ffb1c5

Please sign in to comment.