diff --git a/.github/workflows/contexts.yml b/.github/workflows/contexts.yml new file mode 100644 index 000000000..14e4c17b7 --- /dev/null +++ b/.github/workflows/contexts.yml @@ -0,0 +1,26 @@ +name: contexts + +on: + workflow_call: + outputs: + roman: + value: ${{ jobs.contexts.outputs.roman }} + workflow_dispatch: + +jobs: + contexts: + name: retrieve latest CRDS contexts + runs-on: ubuntu-latest + outputs: + roman: ${{ steps.roman_crds_context.outputs.pmap }} + steps: + - id: roman_crds_context + env: + OBSERVATORY: roman + CRDS_SERVER_URL: https://roman-crds.stsci.edu + run: > + echo "pmap=$( + curl -s -X POST -d '{"jsonrpc": "1.0", "method": "get_default_context", "params": ["${{ env.OBSERVATORY }}", null], "id": 1}' ${{ env.CRDS_SERVER_URL }}/json/ --retry 8 | + python -c "import sys, json; print(json.load(sys.stdin)['result'])" + )" >> $GITHUB_OUTPUT + - run: if [[ ! -z "${{ steps.roman_crds_context.outputs.pmap }}" ]]; then echo ${{ steps.roman_crds_context.outputs.pmap }}; else exit 1; fi diff --git a/.github/workflows/roman_ci.yml b/.github/workflows/roman_ci.yml index 5a9f1c1f8..9c4df6bc3 100644 --- a/.github/workflows/roman_ci.yml +++ b/.github/workflows/roman_ci.yml @@ -41,7 +41,7 @@ jobs: with: minimal: true latest_crds_contexts: - uses: spacetelescope/crds/.github/workflows/contexts.yml@master + uses: ./.github/workflows/contexts.yml crds_context: needs: [ latest_crds_contexts ] runs-on: ubuntu-latest diff --git a/.github/workflows/roman_ci_cron.yaml b/.github/workflows/roman_ci_cron.yaml index d509ede99..d04830366 100644 --- a/.github/workflows/roman_ci_cron.yaml +++ b/.github/workflows/roman_ci_cron.yaml @@ -41,7 +41,7 @@ jobs: minimal: true latest_crds_contexts: if: (github.repository == 'spacetelescope/romancal' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run scheduled tests'))) - uses: spacetelescope/crds/.github/workflows/contexts.yml@master + uses: ./.github/workflows/contexts.yml crds_context: needs: [ latest_crds_contexts ] runs-on: ubuntu-latest diff --git a/.github/workflows/tests_devdeps.yml b/.github/workflows/tests_devdeps.yml index a48106053..83613ede5 100644 --- a/.github/workflows/tests_devdeps.yml +++ b/.github/workflows/tests_devdeps.yml @@ -42,7 +42,7 @@ jobs: minimal: true latest_crds_contexts: if: (github.repository == 'spacetelescope/romancal' && (github.event_name == 'schedule' || github.event_name == 'push' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'run devdeps tests'))) - uses: spacetelescope/crds/.github/workflows/contexts.yml@master + uses: ./.github/workflows/contexts.yml crds_context: needs: [ latest_crds_contexts ] runs-on: ubuntu-latest