DEV: Simplify if conditional for flaky test report steps (#30579)

The previous conditionals was just more complex and harder to
understand.
This commit is contained in:
Alan Guo Xiang Tan 2025-01-07 00:11:24 +08:00 committed by GitHub
parent 0d62863951
commit 78e8316cf0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -314,7 +314,7 @@ jobs:
- name: Check for flaky tests report - name: Check for flaky tests report
id: check-flaky-spec-report id: check-flaky-spec-report
if: always() && github.repository == 'discourse/discourse' && ${{ env.DISCOURSE_TURBO_RSPEC_RETRY_AND_LOG_FLAKY_TESTS == '1' }} if: github.repository == 'discourse/discourse' && env.DISCOURSE_TURBO_RSPEC_RETRY_AND_LOG_FLAKY_TESTS == '1'
run: | run: |
if [ -f tmp/turbo_rspec_flaky_tests.json ]; then if [ -f tmp/turbo_rspec_flaky_tests.json ]; then
echo "exists=true" >> $GITHUB_OUTPUT echo "exists=true" >> $GITHUB_OUTPUT
@ -325,18 +325,18 @@ jobs:
- name: Fetch Job ID - name: Fetch Job ID
id: fetch-job-id id: fetch-job-id
if: always() && steps.check-flaky-spec-report.outputs.exists == 'true' if: steps.check-flaky-spec-report.outputs.exists == 'true'
run: | run: |
job_id=$(ruby script/get_github_workflow_run_job_id.rb ${{ github.run_id }} ${{ github.run_attempt }} '${{ matrix.target }} ${{ matrix.build_type }}') job_id=$(ruby script/get_github_workflow_run_job_id.rb ${{ github.run_id }} ${{ github.run_attempt }} '${{ matrix.target }} ${{ matrix.build_type }}')
echo "job_id=$job_id" >> $GITHUB_OUTPUT echo "job_id=$job_id" >> $GITHUB_OUTPUT
- name: Create flaky tests report artifact - name: Create flaky tests report artifact
if: always() && steps.check-flaky-spec-report.outputs.exists == 'true' if: steps.check-flaky-spec-report.outputs.exists == 'true'
run: cp tmp/turbo_rspec_flaky_tests.json tmp/turbo_rspec_flaky_tests-${{ matrix.build_type }}-${{ matrix.target }}-${{ steps.fetch-job-id.outputs.job_id }}.json run: cp tmp/turbo_rspec_flaky_tests.json tmp/turbo_rspec_flaky_tests-${{ matrix.build_type }}-${{ matrix.target }}-${{ steps.fetch-job-id.outputs.job_id }}.json
- name: Upload flaky tests report - name: Upload flaky tests report
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
if: always() && steps.check-flaky-spec-report.outputs.exists == 'true' if: steps.check-flaky-spec-report.outputs.exists == 'true'
with: with:
name: flaky-test-reports-${{ matrix.build_type }}-${{ matrix.target }} name: flaky-test-reports-${{ matrix.build_type }}-${{ matrix.target }}
path: tmp/turbo_rspec_flaky_tests-${{ matrix.build_type }}-${{ matrix.target }}-${{ steps.fetch-job-id.outputs.job_id }}.json path: tmp/turbo_rspec_flaky_tests-${{ matrix.build_type }}-${{ matrix.target }}-${{ steps.fetch-job-id.outputs.job_id }}.json