name: Sourcegraph code intelligence
on:
  - push

jobs:
  scip-go:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Install scip-go
        run: |
          curl -L https://github.com/sourcegraph/scip-go/releases/download/v0.1.21/scip-go_0.1.21_linux_amd64.tar.gz -o scip-go.tar.gz --no-progress-meter
          tar -xf scip-go.tar.gz
          chmod +x ./scip-go
      - name: Install src
        run: |
          curl -L https://sourcegraph.com/.api/src-cli/src_linux_amd64 -o src --no-progress-meter
          chmod +x ./src
      - name: Generate SCIP data
        run: ./scip-go
      - name: Upload SCIP data to Sourcegraph.com
        run: SRC_ACCESS_TOKEN=${{ secrets.SRC_ACCESS_TOKEN }} ./src code-intel upload -github-token=${{ secrets.GITHUB_TOKEN }} -no-progress

