mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-01 20:34:36 +00:00
* fix(ci): skip empty SDK release PR * fix(ci): skip no-op sdk release branch push * fix(ci): target sdk release from ref on no-op * fix(ci): guard sdk release tagging
47 lines
1.6 KiB
JavaScript
47 lines
1.6 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2026 Qwen Team
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import { readFileSync } from 'node:fs';
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('TypeScript SDK release workflow', () => {
|
|
const workflow = readFileSync('.github/workflows/release-sdk.yml', 'utf8');
|
|
|
|
it('only creates a release PR when the package version changed', () => {
|
|
expect(workflow).toContain("id: 'persist_source'");
|
|
expect(workflow).toContain(
|
|
'echo "HAS_PERSISTED_SOURCE=false" >> "${GITHUB_OUTPUT}"',
|
|
);
|
|
expect(workflow).toContain(
|
|
'echo "HAS_PERSISTED_SOURCE=true" >> "${GITHUB_OUTPUT}"',
|
|
);
|
|
expect(workflow).toContain(
|
|
'echo "::notice::No version changes in sdk-typescript; skipping release branch push and PR creation."',
|
|
);
|
|
expect(workflow).toContain(
|
|
"HAS_PERSISTED_SOURCE: '${{ steps.persist_source.outputs.HAS_PERSISTED_SOURCE }}'",
|
|
);
|
|
expect(workflow).toContain(
|
|
'elif [[ "${HAS_PERSISTED_SOURCE}" == "true" ]]',
|
|
);
|
|
expect(workflow).toContain('TARGET="${RELEASE_BRANCH}"');
|
|
expect(workflow).toContain('TARGET="${REF}"');
|
|
for (const stepName of [
|
|
'Create GitHub Release and Tag',
|
|
'Create PR to merge release branch into main',
|
|
'Enable auto-merge for release PR',
|
|
]) {
|
|
const stepStart = workflow.indexOf(`name: '${stepName}'`);
|
|
const step = workflow.slice(
|
|
stepStart,
|
|
workflow.indexOf('\n - name:', stepStart + 1),
|
|
);
|
|
expect(step).toContain(
|
|
"steps.persist_source.outputs.HAS_PERSISTED_SOURCE == 'true'",
|
|
);
|
|
}
|
|
});
|
|
});
|