Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a single commit check workflow #494

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/check_commits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@
name: Check Commit
on: pull_request
jobs:
single_commit:
name: Assert single commit
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 30
- name: Checkout master
run: git fetch origin master
- name: create local master branch
run: git branch master origin/master
- name: Commit Count Check
run: test `git log --oneline --no-merges HEAD ^master | wc -l ` = 1
runs-on: ubuntu-latest
test:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGES/494.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a workflow to check that PRs contain a single commit.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ The following settings are stored in `template_config.yml`.

noissue_marker A string that is used to mark a commit as not attached to an issue.

single_commit_check Runs a job to check whether a PR contains a single commit or not.

sync_ci Enables a nightly workflow to update the CI files.

test_bindings Include a job that runs a script to test generated client
Expand Down
1 change: 1 addition & 0 deletions plugin-template
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ DEFAULT_SETTINGS = {
"release_user": "pulpbot",
"release_email": "[email protected]",
"noissue_marker": "[noissue]",
"single_commit_check": True,
"sync_ci": True,
"test_bindings": True,
"test_cli": False,
Expand Down
17 changes: 17 additions & 0 deletions templates/github/.github/workflows/ci.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ jobs:

{% if pre_job_template -%}{{ " " | indent }}{% include pre_job_template.path %}{%- endif %}

{%- if single_commit_check %}
single_commit:
name: Assert single commit
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 30
- name: Checkout {{ plugin_default_branch }}
run: git fetch origin {{ plugin_default_branch }}
- name: create local {{ plugin_default_branch }} branch
run: git branch {{ plugin_default_branch }} origin/{{ plugin_default_branch }}
- name: Commit Count Check
run: test `git log --oneline --no-merges HEAD ^{{ plugin_default_branch }} | wc -l ` = 1
runs-on: ubuntu-latest
{%- endif %}

lint:
runs-on: ubuntu-latest
{% if pre_job_template %}needs: {{ pre_job_template.name }}{% endif %}
Expand Down