Skip to content

Commit a36f769

Browse files
committed
ci: read live labels in the migration label job
A queued run's event payload can hold labels from before an earlier run changed them. Read the PR's current labels instead, as the title job does. Signed-off-by: mday-io <mdaytn@gmail.com>
1 parent 7e299cc commit a36f769

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎.github/workflows/pr-labels.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ jobs:
135135
const added = files.some(
136136
(f) => f.status === 'added' && /^sqlmesh\/migrations\/v\d+_.*\.py$/.test(f.filename)
137137
);
138-
const labels = context.payload.pull_request.labels.map((l) => l.name);
138+
// Read live labels: a queued run's event payload can be out of date.
139+
const { data: live } = await github.rest.issues.listLabelsOnIssue({
140+
owner, repo, issue_number, per_page: 100,
141+
});
142+
const labels = live.map((l) => l.name);
139143
if (!added) {
140144
// The PR no longer adds a migration, e.g. the file was removed.
141145
if (labels.includes('migration')) {

0 commit comments

Comments
 (0)