Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,113 @@ jobs:

- name: Build project
run: composer run build

compare-signatures:
runs-on: ubuntu-latest
timeout-minutes: 20
needs: [ coverage ]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Install SDK checker
run: npm install --no-save upsun-sdk-checker@latest

- name: Run SDK comparison (informational)
id: sdk_checker
continue-on-error: true
env:
EXCLUDE_OPTIONAL_PARAMS: "true"
EXCLUDE_DEPRECATED: "true"
SDK_NODE_BRANCH: main
SDK_PHP_BRANCH: ${{ github.head_ref || github.ref_name }}
WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
run: |
set -o pipefail
npx upsun-sdk-checker full:checks 2>&1 | tee sdk-checker-report.txt

- name: Comment SDK comparison output on PR
if: github.event_name == 'pull_request'
continue-on-error: true
uses: actions/github-script@v7
env:
REPORT_PATH: sdk-checker-report.txt
with:
github-token: ${{ secrets.WORKFLOW_TOKEN }}
script: |
const fs = require('fs');
const marker = '<!-- upsun-sdk-checker-report -->';
const reportPath = process.env.REPORT_PATH;

let report = '';
try {
report = fs.readFileSync(reportPath, 'utf8');
} catch (error) {
report = `Unable to read ${reportPath}: ${error.message}`;
}

// Remove ANSI/control sequences and replacement chars to keep PR comments readable.
report = report
.replace(/\u001B\[[0-9;]*[A-Za-z]/g, '')
.replace(/\u009B[0-9;]*[A-Za-z]/g, '')
.replace(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F]/g, '')
.replace(/\uFFFD/g, '');

const maxLength = 60000;
let truncationNote = '';
if (report.length > maxLength) {
report = report.slice(0, maxLength);
truncationNote = `\n\n_Output truncated to ${maxLength} characters._`;
}

const safeReport = report.replace(/```/g, '\\\`\\\`\\\`');
const body = [
marker,
'## Upsun SDK checker report',
'',
'<details>',
'<summary>Display raw output</summary>',
'',
'```text',
safeReport,
'```',
'</details>',
truncationNote
].join('\n');

const { owner, repo } = context.repo;
const issue_number = context.issue.number;

const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
per_page: 100
});

const existing = comments.find(comment =>
comment.user?.type === 'Bot' &&
comment.body?.includes(marker)
);

if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body
});
}
Loading