-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate Pull Request Checklist - Check Tasks Completed
As described in #910, we have a submitter checklists in pull requests that enforce with our standards. Currently, maintainers and reviewers have to manually check that the submitter checklist has been checked off and verify each item in the list. If the submitter checklist has not been checked off, they need to follow up with the user and request them to follow the standards and check them off. In this change, we add automation that checks that the checklist has been checked off. If there's an incomplete item, the check reports that there are incomplete tasks but does not fail yet. In a future change, we will make the check fail if the submitter checklist is not checked off. We hope that enforcing checking off the submitter checklist will encourage contributors to look into our standards and apply them to their contributions. The implementation is modeled after the check-kind-label job.
- Loading branch information
1 parent
8f6b75e
commit a749e56
Showing
6 changed files
with
189 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: github-tasks-completed | ||
namespace: tektonci | ||
description: | | ||
Verifies that a PR has all the tasks completed. A task is considered to be any part of the text that looks like a github markdown checkbox ("- []"). | ||
spec: | ||
params: | ||
- name: body | ||
description: The body of the Pull Request | ||
stepTemplate: | ||
env: | ||
- name: HOME | ||
value: /tekton/home | ||
- name: PULL_REQUEST_BODY | ||
value: $(params.body) | ||
steps: | ||
- name: install-pyyaml | ||
image: python:3-alpine | ||
script: | | ||
pip install pyyaml --user | ||
- name: check-github-tasks-completed | ||
image: python:3-alpine | ||
script: | | ||
#!/usr/bin/env python | ||
import sys | ||
prBodyText = os.getenv('PULL_REQUEST_BODY') | ||
incompleteTasks = prBodyText.count("\n- []") | ||
if incompleteTasks > 0: | ||
msg = "Error: {} incomplete GitHub Tasks found, expecting no incomplete GitHub Tasks".format(incompleteTasks) | ||
print(msg) | ||
# TODO (jerop): comment out in a follow up PR | ||
# Check failed. Return exit code 1. | ||
# sys.exit(1) | ||
else: | ||
print("Found no incomplete GitHub Tasks) | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: tekton-github-tasks-completed | ||
namespace: tektonci | ||
spec: | ||
params: | ||
- name: checkName | ||
description: The name of the GitHub check that this pipeline is used for | ||
- name: gitHubCommand | ||
description: The command that was used to trigger testing | ||
- name: body | ||
description: The body of the Pull Request | ||
tasks: | ||
- name: check-name-matches | ||
taskRef: | ||
name: check-name-matches | ||
params: | ||
- name: gitHubCommand | ||
value: $(params.gitHubCommand) | ||
- name: checkName | ||
value: $(params.checkName) | ||
- name: github-tasks-completed | ||
taskRef: | ||
name: github-tasks-completed | ||
when: | ||
- input: $(tasks.check-name-matches.results.check) | ||
operator: in | ||
values: ["passed"] | ||
params: | ||
- name: body | ||
value: $(params.body) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters