ci: close PRs that have commits made on GitHub Web

This commit is contained in:
Ben Grande 2024-07-01 12:09:07 +02:00
parent 41c2100f0d
commit ded46161f6
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
4 changed files with 86 additions and 3 deletions

View File

@ -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
.github/workflows/reject-pr.yaml vendored Normal file
View File

@ -0,0 +1,56 @@
# yamllint disable-line rule:line-length
# SPDX-FileCopyrightText: 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# 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

View File

@ -3,7 +3,7 @@ Upstream-Name: qusal
Upstream-Contact: Benjamin Grande M. S. <ben.grande.b@gmail.com> Upstream-Contact: Benjamin Grande M. S. <ben.grande.b@gmail.com>
Source: https://github.com/ben-grande/qusal 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. <ben.grande.b@gmail.com> Copyright: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
License: CC-BY-SA-4.0 License: CC-BY-SA-4.0

View File

@ -6,7 +6,7 @@ Qusal contribution guidelines.
* [Respect](#respect) * [Respect](#respect)
* [Starters](#starters) * [Starters](#starters)
* [Requirements](#requirements) * [Environment](#environment)
* [Issues](#issues) * [Issues](#issues)
* [Lint](#lint) * [Lint](#lint)
@ -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. 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 For an automatic setup, use the [dev formula](../salt/dev), else, install the
packages below depending on the task: packages below depending on the task: