ok-to-test-command #533
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: default | ||
concurrency: | ||
group: ${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
on: | ||
repository_dispatch: | ||
types: [ok-to-test-command] | ||
jobs: | ||
default: | ||
runs-on: | ||
- self-hosted | ||
- generic | ||
permissions: | ||
pull-requests: write | ||
checks: write | ||
if: github.event_name == 'repository_dispatch' && contains(github.event.client_payload.pull_request.head.sha) | ||
Check failure on line 16 in .github/workflows/ci.yaml GitHub Actions / defaultInvalid workflow file
|
||
steps: | ||
- run: | | ||
echo "Integration tests... success! ;-)" | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1 | ||
with: | ||
channel-id: proj-talos-maintainers | ||
payload: | | ||
{ | ||
"attachments": [ | ||
{ | ||
"color": "#2EB886", | ||
"fallback": "test", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "pull_request" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Status:*\n" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "section", | ||
"fields": [ | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Author:*\n`${{ github.actor }}`" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*Event:" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Logs" | ||
}, | ||
"url": "" | ||
}, | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Commit" | ||
}, | ||
"url": "${{ github.event.repository.html_url }}/commit/${{ github.sha }}" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
- uses: actions/github-script@v6 | ||
id: update-check-run | ||
if: ${{ always() }} | ||
env: | ||
number: ${{ github.event.client_payload.pull_request.number }} | ||
job: ${{ github.job }} | ||
# Conveniently, job.status maps to https://developer.github.com/v3/checks/runs/#update-a-check-run | ||
conclusion: ${{ job.status }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { data: pull } = await github.rest.pulls.get({ | ||
...context.repo, | ||
pull_number: process.env.number | ||
}); | ||
const ref = pull.head.sha; | ||
const { data: checks } = await github.rest.checks.listForRef({ | ||
...context.repo, | ||
ref | ||
}); | ||
const check = checks.check_runs.filter(c => c.name === process.env.job); | ||
const { data: result } = await github.rest.checks.update({ | ||
...context.repo, | ||
check_run_id: check[0].id, | ||
status: 'completed', | ||
conclusion: process.env.conclusion | ||
}); | ||
return result; |