Skip to content

[WIP] SepTop Protocol #187

[WIP] SepTop Protocol

[WIP] SepTop Protocol #187

Workflow file for this run

name: Check for API breaks
on:
pull_request_target:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --depth=1 --tags
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check for API breaks
continue-on-error: true
id: check
run: |
pip install griffe
griffe check "openfe" --verbose -a origin/main
griffe check "openfecli" --verbose -a origin/main
- name: Manage PR Comments
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const identifier = '<!-- api-break-check -->';
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const stepUrl = `${runUrl}#step:check`;
// Determine the outcome of the check step
const checkStepOutcome = '${{ steps.check.outcome }}';
// List existing comments
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
// Delete previous comments from this action
for (const comment of comments) {
if (comment.body.includes(identifier)) {
await github.rest.issues.deleteComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment.id,
});
}
}
// Post a new comment only if the check step failed
if (checkStepOutcome === 'failure') {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `${identifier}\n🚨 API breaking changes detected! 🚨\n[View logs for this step](${stepUrl})`
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: `${identifier}\nNo API break detected ✅`
});
}