name: "Autobuild working directory"
description: "Tests working-directory input of autobuild action"
versions: ["linked"]
steps:
  - name: Test setup
    run: |
      # Make sure that Gradle build succeeds in autobuild-dir ...
      cp -a ../action/tests/java-repo autobuild-dir
      # ... and fails if attempted in the current directory
      echo > build.gradle
  - uses: ./../action/init
    with:
      languages: java
      tools: ${{ steps.prepare-test.outputs.tools-url }}
  - uses: ./../action/autobuild
    with:
      working-directory: autobuild-dir
  - uses: ./../action/analyze
  - name: Check database
    run: |
      cd "$RUNNER_TEMP/codeql_databases"
      if [[ ! -d java ]]; then
        echo "Did not find a Java database"
        exit 1
      fi
