[IMP] runbot: add draft detection form titl

This commit is contained in:
Xavier-Do 2022-11-24 15:56:21 +01:00 committed by Christophe Monniez
parent 3a9832d747
commit 891d2d71e8
3 changed files with 7 additions and 1 deletions

View File

@ -113,11 +113,11 @@ class Branch(models.Model):
pi = branch.is_pr and (pull_info or pull_info_dict.get((branch.remote_id, branch.name)) or branch._get_pull_info()) pi = branch.is_pr and (pull_info or pull_info_dict.get((branch.remote_id, branch.name)) or branch._get_pull_info())
if pi: if pi:
try: try:
branch.draft = pi.get('draft', False)
branch.alive = pi.get('state', False) != 'closed' branch.alive = pi.get('state', False) != 'closed'
branch.target_branch_name = pi['base']['ref'] branch.target_branch_name = pi['base']['ref']
branch.pull_head_name = pi['head']['label'] branch.pull_head_name = pi['head']['label']
branch.pr_title = pi['title'] branch.pr_title = pi['title']
branch.draft = pi.get('draft', False) or branch.pr_title and (branch.pr_title.startswith('[DRAFT]') or branch.pr_title.startswith('[WIP]'))
branch.pr_body = pi['body'] branch.pr_body = pi['body']
branch.pr_author = pi['user']['login'] branch.pr_author = pi['user']['login']
pull_head_repo_name = False pull_head_repo_name = False

View File

@ -45,6 +45,10 @@
<td>Target Branch</td> <td>Target Branch</td>
<td t-esc="branch.target_branch_name"></td> <td t-esc="branch.target_branch_name"></td>
</tr> </tr>
<tr>
<td>Pr title</td>
<td t-esc="branch.pr_title"/>
</tr>
</t> </t>
<t t-elif="branch_pr"> <t t-elif="branch_pr">
<tr> <tr>

View File

@ -19,6 +19,8 @@
<field name="target_branch_name"/> <field name="target_branch_name"/>
<field name="head"/> <field name="head"/>
<field name="alive"/> <field name="alive"/>
<field name="pr_title"/>
<field name="pr_body"/>
</group> </group>
</sheet> </sheet>
</form> </form>