Update adapters concept documentation #20
Workflow file for this run
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: pr-commenter | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
jobs: | |
comment: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
checks: read | |
steps: | |
- name: Check pre-commit status | |
id: check_status | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.BUILD_TOKEN }} | |
script: | | |
const maxAttempts = 3; | |
const delay = 10000; // 10 seconds | |
let conclusion = 'unknown'; // Initialize conclusion variable | |
for (let attempt = 0; attempt < maxAttempts; attempt++) { | |
const { data: checks } = await github.rest.checks.listForRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: context.payload.pull_request.head.sha, | |
}); | |
const precommitCheck = checks.check_runs.find(check => check.name === 'pre-commit'); | |
if (precommitCheck) { | |
conclusion = precommitCheck.conclusion; | |
break; // Use break instead of return to ensure conclusion is set | |
} | |
if (attempt < maxAttempts - 1) { | |
await new Promise(resolve => setTimeout(resolve, delay)); | |
} | |
} | |
core.setOutput('conclusion', conclusion); | |
# https://docs.github.com/en/rest/issues/comments#create-an-issue-comment | |
- name: Post PR comment if pre-commit failed | |
if: steps.check_status.outputs.conclusion == 'failure' | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.BUILD_TOKEN }} | |
script: | | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: 'Thank you for your contribution! 🙏\n\nThe pre-commit checks have failed. Please run `make pre-commit` (or `pre-commit run --all-files`) to fix formatting issues.\n\nSee our [CONTRIBUTING.md](https://github.com/nautechsystems/nautilus_trader/blob/develop/CONTRIBUTING.md) guide for details.' | |
}); |