Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions .github/workflows/auth-react-test-1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,22 @@ jobs:
runs-on: ubuntu-latest
outputs:
fdiVersions: ${{ steps.versions.outputs.fdiVersions }}

nodeFdiVersionMap: ${{ steps.node-versions.outputs.fdiVersions }}
steps:
- uses: actions/checkout@v4
- uses: supertokens/get-supported-versions-action@main
id: versions
with:
has-fdi: true

- uses: supertokens/actions/get-versions-from-repo@main
id: node-versions
with:
repo: supertokens-node
github-token: ${{ secrets.GITHUB_TOKEN }}
fdi-versions: ${{ steps.versions.outputs.fdiVersions }}

setup-auth-react:
runs-on: ubuntu-latest
needs: define-versions
Expand All @@ -45,21 +54,30 @@ jobs:
AUTH_REACT__PORT: ${{ steps.envs.outputs.AUTH_REACT__PORT }}
specs: ${{ steps.envs.outputs.specs }}
fdiVersions: ${{ needs.define-versions.outputs.fdiVersions }}
nodeFdiVersionMap: ${{ needs.define-versions.outputs.nodeFdiVersionMap }}

steps:
- uses: supertokens/get-versions-action@main
id: versions
- id: repo-versions
run: |
nodeVersion=$( echo '${{ needs.define-versions.outputs.nodeFdiVersionMap }}' | jq -r '.["${{ matrix.fdi-version }}"]' )
echo "nodeVersion=${nodeVersion}" >> $GITHUB_OUTPUT

# We will use this in the test run to get the core version
- uses: actions/checkout@v4
with:
driver-name: node
fdi-version: ${{ matrix.fdi-version }}
env:
SUPERTOKENS_API_KEY: ${{ secrets.SUPERTOKENS_API_KEY }}
repository: supertokens/supertokens-node
ref: ${{ steps.repo-versions.outputs.nodeVersion }}
path: supertokens-node

# Makes npm use HTTP instead of SSH for installs
- name: Reconfigure git to use HTTP authentication
run: git config --global url."https://github.com/".insteadOf ssh://[email protected]/

- uses: supertokens/auth-react-testing-action/setup@main
id: envs
with:
auth-react-version: ${{ github.sha }}
node-sdk-version: ${{ steps.versions.outputs.nodeTag }}
node-sdk-version: ${{ steps.repo-versions.outputs.nodeVersion }}
fdi-version: ${{ matrix.fdi-version }}
use-common-app-and-test-server: "true"

Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/auth-react-test-2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,38 @@ jobs:
AUTH_REACT__PORT: ${{ inputs.AUTH_REACT__PORT }}

steps:
- uses: actions/checkout@v4
- uses: bissolli/gh-action-persist-workspace@v2
with:
path: supertokens-auth-react
action: retrieve
artifactName: auth-react-${{ inputs.fdi-version }}

- name: Get Node CDI versions
id: node-cdi-versions
uses: supertokens/get-supported-versions-action@main
with:
has-cdi: true
working-directory: supertokens-node

- uses: supertokens/actions/get-versions-from-repo@main
id: core-versions
with:
repo: supertokens-core
github-token: ${{ secrets.GITHUB_TOKEN }}
cdi-versions: ${{ steps.node-cdi-versions.outputs.cdiVersions }}

- name: Get core version from latest Node CDI version
id: core-version
run: |
lastNodeCdiVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]') | sed -e 's/"/\\"/g'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a syntax error in this line. The pipe (|) after the closing parenthesis is causing the sed command to run separately from the variable assignment, which isn't what you want. The correct syntax would be:

lastNodeCdiVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]')

If you need to escape quotes in the variable, you could include the sed command inside the command substitution:

lastNodeCdiVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]' | sed -e 's/"/\\"/g')
Suggested change
lastNodeCdiVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]') | sed -e 's/"/\\"/g'
lastNodeCdiVersion=$(echo '${{ steps.node-cdi-versions.outputs.cdiVersions }}' | jq -r '.[-1]' | sed -e 's/"/\\"/g')

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

coreVersion=$(echo '${{ steps.core-versions.outputs.cdiVersions }}' | jq -r ".[$lastNodeCdiVersion]")

echo "coreVersion=${coreVersion}" >> $GITHUB_OUTPUT

- name: Start core
run: docker compose up --wait
working-directory: supertokens-auth-react
env:
SUPERTOKENS_CORE_VERSION: ${{ steps.core-version.outputs.coreVersion }}

- uses: supertokens/auth-react-testing-action@main
name: test ${{ matrix.spec }} for ${{ inputs.fdi-version }}
Expand All @@ -80,3 +105,4 @@ jobs:
check-name-suffix: "[FDI=${{ inputs.fdi-version }}][Spec=${{ matrix.spec }}]"
path: supertokens-auth-react
spec: ${{ matrix.spec }}
retrieve-workspace: false
Loading