Skip to content

Commit

Permalink
devops: merge reports on PRs only (#24307)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Jul 19, 2023
1 parent eac47ce commit e3ef358
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions .github/workflows/create_test_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
permissions:
pull-requests: write
checks: write
if: ${{ github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -23,18 +24,10 @@ jobs:
- run: npm run build

- name: Download blob report artifact
if: ${{ always() && github.event.workflow_run.event == 'pull_request' }}
uses: ./.github/actions/download-artifact
with:
name: 'blob-report-${{ github.event.workflow_run.run_attempt }}'
path: 'blob-report'
- name: Download blob report from Azure
if: ${{ always() && github.event.workflow_run.event == 'push' }}
uses: ./.github/actions/download-blob-report-from-azure
with:
blob_prefix: 'run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}'
output_dir: 'blob-report'
connection_string: '${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}'

- name: Merge reports
run: |
Expand All @@ -47,13 +40,11 @@ jobs:
echo "Report url: https://mspwblobreport.z1.web.core.windows.net/$REPORT_DIR/index.html"
- name: Upload blob report to Azure
if: ${{ github.event.workflow_run.event == 'pull_request' }}
run: |
REPORT_DIR='run-${{ github.event.workflow_run.id }}-${{ github.event.workflow_run.run_attempt }}-${{ github.sha }}'
az storage blob upload-batch -s blob-report -d "\$web/$REPORT_DIR" --connection-string "${{ secrets.AZURE_CONNECTION_STRING_FOR_BLOB_REPORT }}"
- name: Read pull request number
if: ${{ always() && github.event.workflow_run.event == 'pull_request' }}
uses: ./.github/actions/download-artifact
with:
name: 'pull-request'
Expand All @@ -74,16 +65,6 @@ jobs:
prNumber = parseInt(fs.readFileSync('pull_request_number.txt').toString());
console.log('Read pull request number from file: ' + prNumber);
}
} else if (context.payload.workflow_run.event === 'push') {
const { data } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: context.sha,
});
if (!data.length) {
core.info(`No pull request found for commit ${context.sha}. Not publishing anything.`);
return;
}
prNumber = data[0].number;
} else {
core.error('Unsupported workflow trigger event: ' + context.payload.workflow_run.event);
return;
Expand Down

0 comments on commit e3ef358

Please sign in to comment.