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

Improve Pull Request Action behavior #330

Open
jenstroeger opened this issue Sep 21, 2022 · 2 comments
Open

Improve Pull Request Action behavior #330

jenstroeger opened this issue Sep 21, 2022 · 2 comments

Comments

@jenstroeger
Copy link
Owner

jenstroeger commented Sep 21, 2022

The pull-request.yaml Action may not need to trigger the code checks and tests:

build:
needs: conventional-commits
uses: ./.github/workflows/build.yaml
permissions:
contents: read

if the PR is in “draft” mode — the event payload has a boolean "draft":

build: 
  needs: conventional-commits 
  if: ${{ !github.event.pull_request.draft }}

that we should be able to check. A draft PR by definition is incomplete and may or may not pass checks and tests…

Furthermore, I am tempted to change this

pull_request:
branches:
- main
- staging

to

 pull_request: 
   branches: 
   - *

to target all PRs regardless of their base branch (i.e. PRs that target other PRs).

We also don’t need to run checks and tests if the PR body discussion has had an entry but there was no code change. In that case, maybe only run cz (because the PR title was changed), for example:

build: 
  needs: conventional-commits 
  if: ${{ github.event.action !== 'edited' }}

Skipping the build job, however, means that no artifacts are produced by that particular Action run, which is probably acceptable.

@jenstroeger jenstroeger changed the title Skip Pull Request Action on Draft PRs Improve Pull Request Action behavior Sep 22, 2022
@jenstroeger
Copy link
Owner Author

@behnazh I think we can close this one now? Two related issues are merged.

@jenstroeger
Copy link
Owner Author

It would make sense, methinks, to expand the PR Action to check that a PR does not modify certain files. These “protected” files could be stored in the repository in a dedicated dot-file, e.g. .donottouch.

The intention is to prevent people from modifying these files in downstream repositories, and enforce modifying these files in the parent template repository. Protected files would be e.g. the Makefile or .pre-commit-config.yaml.

(Related issue #370.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant