diff --git a/.github/workflows/check-api-changes.yml b/.github/workflows/check-api-changes.yml index 6d13846c5..72918b7d1 100644 --- a/.github/workflows/check-api-changes.yml +++ b/.github/workflows/check-api-changes.yml @@ -52,7 +52,7 @@ jobs: - name: Get API changes id: api-changed - uses: tj-actions/changed-files@v34.5.3 + uses: tj-actions/changed-files@v35.1.1 with: base_sha: 'HEAD~1' sha: 'HEAD' diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.yml index c6e2ddf89..6bfa210e4 100644 --- a/.github/workflows/license-header.yml +++ b/.github/workflows/license-header.yml @@ -29,29 +29,32 @@ jobs: with: mode: fix - - name: Apply Changes + - name: List files changed + id: files-changed shell: bash -l {0} run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git add * - git commit --allow-empty -m "Automatic application of license header" + set -ex + export CHANGES=$(git status --porcelain | tee modified.log | wc -l) + cat modified.log + # Remove the log otherwise it will be committed + rm modified.log - - name: Get modified files in the staging directory - id: changed-files - uses: tj-actions/changed-files@v34.5.3 - with: - since_last_remote_commit: "true" - sha: 'HEAD' + echo "N_CHANGES=${CHANGES}" >> $GITHUB_OUTPUT - - name: Push fixes - if: steps.changed-files.outputs.any_changed == 'true' + git diff + + - name: Commit any changes + if: steps.files-changed.outputs.N_CHANGES != '0' shell: bash -l {0} run: | - echo "Changed files:" - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do - echo " $file" - done + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git pull --no-tags + + git add * + git commit -m "Automatic application of license header" + git config push.default upstream git push env: