qusal/.github/workflows/reject-pr.yaml
Ben Grande 011a71a36d
style: limit line length per file extension
Editorconfig can only act based on file extension and path, not
attributes, it remains a mean only for multiple collaborators to use the
same configuration on their editor. When it is too restrictive, such as
not considering the file syntax, use a lint tool for the specific file
type instead of trusting editorconfig. Changes were made to increase
readability.
2024-07-09 17:42:07 +02:00

61 lines
1.9 KiB
YAML

# 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
jobs:
reject-pr:
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: false
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Block commits made using the GitHub WebUI
id: check_committer
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 "committer_gitweb=true" >> $GITHUB_OUTPUT
echo "Commit was made using the GitHub WebUI" >&2
fi
- name: Block commits made using the GitHub WebUI
if: steps.check_committer.outputs.committer_gitweb == 'true'
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