diff --git a/.github/check_for_changes.py b/.github/check_for_changes.py index c80939d23a..870345ac19 100644 --- a/.github/check_for_changes.py +++ b/.github/check_for_changes.py @@ -34,6 +34,11 @@ def main(): if not changed_files or all(file == '' for file in changed_files): print("No changes detected in autopts/wid directory.") changed_files = [] + else: + with open(".env", "a") as env_file: + env_var = "CHANGES_DETECTED" + env_val = "true" + env_file.write(f"{env_var}={env_val}") filenames = [] diff --git a/.github/workflows/run_cron_from_pr.yaml b/.github/workflows/run_cron_from_pr.yaml index 3df5b3191d..a0a19c1692 100644 --- a/.github/workflows/run_cron_from_pr.yaml +++ b/.github/workflows/run_cron_from_pr.yaml @@ -22,26 +22,20 @@ jobs: id: check_changes run: | python .github/check_for_changes.py - if [ -z changed_files_formatted.txt ]; then - echo "changes_detected=true" >> $GITHUB_OUTPUT - else - echo "changes_detected=false" >> $GITHUB_OUTPUT - exit 0 - fi - name: Set output id: set_output - if: ( steps.check_changes.outputs.changes_detected == 'true' ) + if: env.CHANGES_DETECTED == 'true' run: | echo "changed_files=$(cat changed_files_formatted.txt)" >> $GITHUB_OUTPUT - name: Print changed - if: ( steps.check_changes.outputs.changes_detected == 'true' ) + if: env.CHANGES_DETECTED == 'true' run: | echo "Changed files: ${{ steps.set_output.outputs.changed_files }}" - name: Post comment on PR - if: ( steps.check_changes.outputs.changes_detected == 'true' ) + if: env.CHANGES_DETECTED == 'true' uses: peter-evans/create-or-update-comment@v4 with: token: ${{ secrets.GITHUB_TOKEN }} @@ -50,7 +44,7 @@ jobs: \#AutoPTS run mynewt ${{ steps.set_output.outputs.changed_files }} --test-case-limit 10 - name: Post comment on PR - if: ( steps.check_changes.outputs.changes_detected == 'true' ) + if: env.CHANGES_DETECTED == 'true' uses: peter-evans/create-or-update-comment@v4 with: token: ${{ secrets.GITHUB_TOKEN }}