opendatahub-io / notebooks

Notebook images for ODH
Apache License 2.0
15 stars 51 forks source link

Maybe get a list of changed files using git diff and pass them to the script? #560

Closed jiridanek closed 2 days ago

jiridanek commented 3 weeks ago
          Not sure we need all that but I tend to minimize the number of external calls in build processes in favor of things that can be retrieved internally to avoid issues. Let's keep an eye on it. If it becomes an issue, we can use something like the code below:
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Diff
        shell: bash
        run: |
          git fetch origin ${{ github.base_ref }}

          base_sha=$(git rev-parse origin/${{ github.base_ref }})
          head_sha=$(git rev-parse ${{ github.sha }})

          changed_files=($(git diff --name-only $base_sha $head_sha))

          echo "Changed files:"
          for file in "${changed_files[@]}"; do
              echo "$file"
          done

_Originally posted by @caponetto in https://github.com/opendatahub-io/notebooks/pull/558#discussion_r1638245768_

jiridanek commented 3 weeks ago

Looks like I can leave out git fetch and git rev-parse. See the FromRef usage in blog

run: "& .github/workflows/create-test-matrix.ps1 -FromRef '${{ github.base_ref }}'"

https://purple.telstra.com/blog/github-action-test-matrices-part2