Skip to content

fix issue #1042 and also test openfecli for API breaks #128

fix issue #1042 and also test openfecli for API breaks

fix issue #1042 and also test openfecli for API breaks #128

Workflow file for this run

name: Check for API breaks
on:
pull_request:
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: Post Comment on Failure
if: steps.check.outcome == 'failure'
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`;
// 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
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})`
});