Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add env variable #55

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/check_for_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/run_cron_from_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
Loading