Skip to content

Commit 6a021dc

Browse files
committed
revision: track pull request head SHA (bug 2005795)
- add Revision.pull_head_sha field - add migrations - store pull_head_sha when landing job is created
1 parent f11e7f8 commit 6a021dc

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/lando/api/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ class Form(forms.Form):
282282
}
283283
revision = Revision.objects.create(
284284
pull_number=pull_request.number,
285+
pull_head_sha=pull_request.head_sha,
285286
patches=pull_request.patch,
286287
patch_data=patch_data,
287288
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.8 on 2025-12-12 18:42
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("main", "0039_alter_repo_hooks_PreventDotGithubCheck"),
10+
]
11+
12+
operations = [
13+
migrations.AddField(
14+
model_name="revision",
15+
name="pull_head_sha",
16+
field=models.CharField(blank=True, max_length=40, null=True),
17+
),
18+
]

src/lando/main/models/revision.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ class Revision(BaseModel):
5050
# GitHub pull request number, if this is a pull request.
5151
pull_number = models.IntegerField(blank=True, null=True)
5252

53+
# GitHub pull request head SHA, if this is a pull request.
54+
pull_head_sha = models.CharField(max_length=40, blank=True, null=True)
55+
5356
# The generated patch with Mercurial metadata format.
5457
# This patch is generated by combining a diff and patch metadata.
5558
patch = models.TextField(blank=True, default="")

0 commit comments

Comments
 (0)