From 23bea2692b33f69ea765993c8bd67146b1f0df1a Mon Sep 17 00:00:00 2001 From: github-actions Date: Thu, 24 Oct 2024 17:32:10 +0100 Subject: [PATCH] add check for if there are even changes --- .github/workflows/copy-content.yml | 40 +++++++++--------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/.github/workflows/copy-content.yml b/.github/workflows/copy-content.yml index d6d1fedc..0701a3e1 100644 --- a/.github/workflows/copy-content.yml +++ b/.github/workflows/copy-content.yml @@ -79,42 +79,26 @@ jobs: - name: Copy files run: cp -r source/${{ inputs.source_dir }}/* destination/${{ inputs.destination_dir }} - - name: Commit changes + - name: Stage destintation changes + run: | cd destination git config --global user.name "zeta-icons-bot" git config --global user.email "zeta-icons-bot@github.com" git add -A + + - name: Check if there are changes + id: changed + run: | + cd destination + git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT + + - name: Commit and push changes + if: steps.changed.outputs.changed == 'true' + run: | git commit -m "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}" git push --set-upstream origin ${{inputs.branch}} -f - # - name: Push files if branch exists - # uses: dmnemec/copy_file_to_another_repo_action@main - # if: ${{ steps.check_branch.outputs.branch_exists != 0 }} - # env: - # API_TOKEN_GITHUB: ${{ secrets.PAT }} - # with: - # source_file: ${{ inputs.source_dir }} - # destination_repo: ${{ inputs.repo }} - # destination_folder: ${{ inputs.destination_dir }} - # destination_branch: ${{ inputs.branch }} - # user_email: "zeta-tokens-bot@github.com" - # user_name: "Zeta Tokens Bot" - # commit_message: "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}" - # - name: Push files if branch does not exist - # uses: dmnemec/copy_file_to_another_repo_action@main - # if: ${{ steps.check_branch.outputs.branch_exists == 0 }} - # env: - # API_TOKEN_GITHUB: ${{ secrets.PAT }} - # with: - # source_file: ${{ inputs.source_dir }} - # destination_repo: ${{ inputs.repo }} - # destination_folder: ${{ inputs.destination_dir }} - # destination_branch_create: ${{ inputs.branch }} - # user_email: "zeta-tokens-bot@github.com" - # user_name: "Zeta Tokens Bot" - # commit_message: "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}" - - name: Open PR uses: thecanadianroot/open-pull-request-action@v1.1.1 if: ${{ steps.check_pr.outputs.pr_exists == 0 }}