Skip to content

Commit

Permalink
ci: close PRs that have commits made on GitHub Web
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-grande committed Jul 1, 2024
1 parent 41c2100 commit ded4616
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 3 deletions.
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Contribution checklist

Before contributing, I, the opener of this request:

- [ ] Agree to use the same license of each modified file;
- [ ] Have followed the [contribution guidelines](docs/CONTRIBUTE.md);
- [ ] I have tested it locally;
- [ ] I have committed locally and not through a git hosting service such as
GitHub Web; and
- [ ] I have reviewed and updated any documentation if relevant.

Lacking to check any of the above can result in the rejection of the
contribution without no further comment.

## What does this PR aims to accomplish?



## What does this PR change?
<!-- Issues must be referenced if they exist
https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests
-->


.
56 changes: 56 additions & 0 deletions .github/workflows/reject-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# yamllint disable-line rule:line-length
# SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later

---
name: Reject pull requests of user's that don't read the contribution guidelines

# yamllint disable-line rule:truthy
on:
pull_request:
types:
- opened
- reopened
- synchronize

concurrency:
group: ci-${{ github.ref }}-1
cancel-in-progress: true

jobs:
lint:
strategy:
fail-fast: false
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
- name: Block commits made using the GitHub WebUI
if: failure()
uses: peter-evans/close-pull@v3
with:
# yamllint disable-line rule:line-length
comment: 'Automatically closing this PR due to submitter not reading the contribution guidelines and using GitHub WebUI to commit. Please fix the issues and open a new PR after you have read the contribution guidelines.'
delete-branch: false
run: |
if test "${{ github.event_name}}" = "pull_request"
then
base="${{ github.event.pull_request.base.sha }}"
head="${{ github.event.pull_request.head.sha }}"
else
base="${{ github.event.before }}"
head="${{ github.event.after }}"
fi
if test "${base}" = "${head}" || test -z "${base}"
then
committer="$(git show -s --format=%cn ${head})"
else
committer="$(git show -s --format=%cn ${base}..${head})"
fi
if echo "${committer}" | grep -q "^GitHub$"; then
echo "Commit was made using the GitHub WebUI" >&2
exit 1
fi
2 changes: 1 addition & 1 deletion .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Upstream-Name: qusal
Upstream-Contact: Benjamin Grande M. S. <[email protected]>
Source: https://github.com/ben-grande/qusal

Files: README.md */README.md docs/* .github/ISSUE_TEMPLATE/*
Files: README.md */README.md docs/* .github/*_TEMPLATE/*
Copyright: 2023 - 2024 Benjamin Grande M. S. <[email protected]>
License: CC-BY-SA-4.0

Expand Down
6 changes: 4 additions & 2 deletions docs/CONTRIBUTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Qusal contribution guidelines.

* [Respect](#respect)
* [Starters](#starters)
* [Requirements](#requirements)
* [Environment](#environment)
* [Issues](#issues)
* [Lint](#lint)

Expand Down Expand Up @@ -40,8 +40,10 @@ made and what can be improved, see the [design guide](DESIGN.md).

Experiment with some formulas, read them, understand what is being done.

## Environment

## Requirements
Setting up your environment is mandatory. Commits made using the Github Web
interface will be rejected.

For an automatic setup, use the [dev formula](../salt/dev), else, install the
packages below depending on the task:
Expand Down

0 comments on commit ded4616

Please sign in to comment.