Skip to content

Commit

Permalink
fix: Исправлена ссылка на логи в Slack нотификации
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitive authored and qtm committed Jan 28, 2022
1 parent 2ddb8cf commit 577ba7a
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions modules/tools/src/commands/generate-periodic-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function generatePeriodicRunWorkflow({ url, command, run, id, config }) {
workflow_dispatch: {},
},
permissions: {
actions: 'none',
actions: 'read',
checks: 'none',
contents: 'read',
deployments: 'none',
Expand Down Expand Up @@ -60,6 +60,24 @@ function generatePeriodicRunWorkflow({ url, command, run, id, config }) {
LAUNCH_URL: url,
},
},

run.slackChannel && {
if: 'always()',
uses: 'actions/github-script@v4',
id: 'query-jobs',
with: {
script: [
'const result = await github.actions.listJobsForWorkflowRun({',
' owner: context.repo.owner,',
' repo: context.repo.repo,',
' run_id: ${{ github.run_id }},',
'})',
'return result.data.jobs[0].id',
].join('\n'),
'result-encoding': 'string',
},
},

run.slackChannel && {
if: 'failure()',
name: 'Send failure to Slack',
Expand All @@ -77,7 +95,7 @@ function generatePeriodicRunWorkflow({ url, command, run, id, config }) {
command,
'```',
'',
'Логи: https://github.com/${{ github.repository }}/runs/${{ job.id }}?check_suite_focus=true',
'Логи: https://github.com/${{ github.repository }}/runs/${{ steps.query-jobs.outputs.result }}?check_suite_focus=true',
'',
'https://s.csssr.ru/U09LGPMEU/20200731115800.jpg?run=${{ github.run_id }}',
].join('\n'),
Expand All @@ -100,7 +118,7 @@ function generatePeriodicRunWorkflow({ url, command, run, id, config }) {
command,
'```',
'',
'Логи: https://github.com/${{ github.repository }}/runs/${{ job.id }}?check_suite_focus=true',
'Логи: https://github.com/${{ github.repository }}/runs/${{ steps.query-jobs.outputs.result }}?check_suite_focus=true',
'',
'https://s.csssr.ru/U09LGPMEU/20200731115845.jpg?run=${{ github.run_id }}',
].join('\n'),
Expand Down

0 comments on commit 577ba7a

Please sign in to comment.