From 4c6abfa10b0af22bf341aa79e4f58188fb8e1494 Mon Sep 17 00:00:00 2001 From: Lyndon Maydwell Date: Tue, 16 Apr 2024 09:45:52 +1000 Subject: [PATCH] check for first commit --- .github/workflows/registry-updates.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/registry-updates.yaml b/.github/workflows/registry-updates.yaml index 5a9ccbc2..7c6a0326 100644 --- a/.github/workflows/registry-updates.yaml +++ b/.github/workflows/registry-updates.yaml @@ -16,8 +16,20 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Check if it's the first commit on branch + id: check_first_commit + run: | + if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then + echo "::set-output name=first_commit::true" + else + echo "::set-output name=first_commit::false" + fi + - name: List changed files id: list_files run: | - git diff --name-only ${{ github.event.before }} ${{ github.event.after }} > changed_files.txt - + if [ "${{ steps.check_first_commit.outputs.first_commit }}" == "true" ]; then + git ls-tree --name-only -r ${{ github.sha }} > changed_files.txt + else + git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_files.txt + fi