diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 24b6072..ed8c581 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -34,4 +34,23 @@ jobs: EXTRA_TAGS: "@foo:bar @alpha:bravo @test.node.version:${{ matrix.version}}" DD_API_KEY: ${{ secrets.DD_API_KEY_CI_VISIBILITY }} DD_APP_KEY: ${{ secrets.DD_APP_KEY_CI_VISIBILITY }} - DD_SERVICE: junit-upload-github-action-tests \ No newline at end of file + DD_SERVICE: junit-upload-github-action-tests + test-older-datadog-ci-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Grab second latest version of @datadog/datadog-ci + run: | + SECOND_LATEST_VERSION=$(curl -s "https://api.github.com/repos/datadog/datadog-ci/releases" | jq '[.[] | {tag_name: .tag_name, published_at: .published_at}] | sort_by(.published_at) | reverse | .[:2] | .[1] | .tag_name') + echo "SECOND_LATEST_VERSION=$SECOND_LATEST_VERSION" >> $GITHUB_ENV + - name: Upload reports using a glob pattern + uses: ./ + with: + api-key: ${{secrets.DD_API_KEY_CI_VISIBILITY}} + logs: "true" + files: '**/fixtures/**' + service: junit-upload-github-action-tests + env: ci + tags: "foo:bar,alpha:bravo" + datadog-ci-version: ${{ env.SECOND_LATEST_VERSION }} + \ No newline at end of file diff --git a/README.md b/README.md index 0f3d3d9..d2e1b51 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ This action downloads the [datadog-ci](https://github.com/DataDog/datadog-ci) and uses it to upload JUnitXML files to the [CI Visibility product](https://docs.datadoghq.com/continuous_integration/). -This action sets up node and requires node `>=10.24.1`. You can configure a specific version of node to use. +This action sets up node and requires node `>=14`. You can configure a specific version of node to use. Note that if you have setup another version already it will override it. ## Usage @@ -38,4 +38,5 @@ The action has the following options: | `tags` | Optional extra tags to add to the tests | False | | | `env` | Optional environment to add to the tests | False | | | `logs` | When set to "true" enables forwarding content from the XML reports as Logs. The content inside ``, ``, and `` is collected as logs. Logs from elements inside a `` are automatically connected to the test. | False | | +| `datadog-ci-version` | Optionally pin the @datadog/datadog-ci version. | False | `latest` | | `extra-args` | Extra args to be passed to the datadog-ci junit upload command.| False | | diff --git a/action.yaml b/action.yaml index f8dac84..c26028a 100644 --- a/action.yaml +++ b/action.yaml @@ -33,6 +33,10 @@ inputs: logs: required: false description: Set to "true" to enable forwarding content from XML reports as logs. + datadog-ci-version: + required: false + description: The version of the @datadog/datadog-ci package to use. It defaults to the latest release (`latest`). + default: "latest" extra-args: default: "" description: Extra args to be passed to the datadog-ci cli. @@ -48,7 +52,7 @@ runs: if: ${{ inputs.logs == 'true' }} shell: bash run: | - npx @datadog/datadog-ci junit upload \ + npx @datadog/datadog-ci@${{ inputs.datadog-ci-version}} junit upload \ --service ${{ inputs.service }} \ --logs \ --max-concurrency ${{ inputs.concurrency }} \ @@ -63,7 +67,7 @@ runs: if: ${{ inputs.logs != 'true' }} shell: bash run: | - npx @datadog/datadog-ci junit upload \ + npx @datadog/datadog-ci@${{ inputs.datadog-ci-version}} junit upload \ --service ${{ inputs.service }} \ --max-concurrency ${{ inputs.concurrency }} \ ${{ inputs.extra-args }} \