refactor: split smoke and integration test configs into separate CI jobs (#264)
* refactor: split smoke and integration test configs into separate CI jobs * fix: move CLA labeling from triage to CLA workflow * fix: install formatters in temp dir to avoid catalog: protocol error * fix: handle 404 when removing labels that don't exist on the PR
This commit is contained in:
44
.github/workflows/cla.yml
vendored
44
.github/workflows/cla.yml
vendored
@@ -27,3 +27,47 @@ jobs:
|
||||
branch: "cla-signatures"
|
||||
allowlist: dependabot[bot]
|
||||
lock-pullrequest-aftermerge: false
|
||||
|
||||
- name: Label CLA status
|
||||
if: always() && (github.event_name == 'pull_request_target' || github.event.issue.pull_request)
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const prNumber = context.payload.pull_request?.number || context.payload.issue?.number;
|
||||
if (!prNumber) return;
|
||||
|
||||
const owner = context.repo.owner;
|
||||
const repo = context.repo.repo;
|
||||
|
||||
// Get the PR to read head SHA
|
||||
const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: prNumber });
|
||||
|
||||
// Read the CLA commit status
|
||||
const { data: statuses } = await github.rest.repos.listCommitStatusesForRef({
|
||||
owner, repo, ref: pr.head.sha,
|
||||
});
|
||||
const claStatus = statuses.find(s => s.context === 'license/cla');
|
||||
if (!claStatus) return;
|
||||
|
||||
const signed = claStatus.state === 'success';
|
||||
const addLabel = signed ? 'cla: signed' : 'cla: needed';
|
||||
const removeLabel = signed ? 'cla: needed' : 'cla: signed';
|
||||
|
||||
// Ensure labels exist
|
||||
const labelColors = { 'cla: signed': '0e8a16', 'cla: needed': 'b60205' };
|
||||
try {
|
||||
await github.rest.issues.getLabel({ owner, repo, name: addLabel });
|
||||
} catch {
|
||||
await github.rest.issues.createLabel({ owner, repo, name: addLabel, color: labelColors[addLabel] });
|
||||
}
|
||||
|
||||
// Add the correct label
|
||||
const currentLabels = pr.labels.map(l => l.name);
|
||||
if (!currentLabels.includes(addLabel)) {
|
||||
await github.rest.issues.addLabels({ owner, repo, issue_number: prNumber, labels: [addLabel] });
|
||||
}
|
||||
|
||||
// Remove the stale label
|
||||
if (currentLabels.includes(removeLabel)) {
|
||||
await github.rest.issues.removeLabel({ owner, repo, issue_number: prNumber, name: removeLabel });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user