DEV Community

Cover image for How to lint PRs and welcome contributors using GitHub Actions
TED Vortex (Teodor Eugen Duțulescu) for OpenSauced

Posted on Edited on

How to lint PRs and welcome contributors using GitHub Actions

Motivation

Expanding the @open-sauced ecosystem, it became tedious to apply all the necessary tooling available in open-sauced/open-sauced to newly created repositories and synchronising existing ones with minor updates.

Having github actions reusable workflows, we figured it would make a lot of sense to centralise our workflows and referencing them in other repositories.

The process was very simple and we want to showcase how to apply a similar process for your own organisation.

My Workflow

name: "Compliance"

on:
  pull_request_target:
    types:
      - opened
      - edited
      - synchronize

permissions:
  pull-requests: write

jobs:
  compliance:
    uses: open-sauced/open-sauced/.github/workflows/compliance.yml@main
Enter fullscreen mode Exit fullscreen mode

The full workflow is available here: .github/workflows/compliance.yml

Submission Category: Maintainer Must-Haves

Yaml File or Link to Code

Live repository using this workflow:

GitHub logo open-sauced / conventional-commit

commit binary powered by commitizen with conventional commit standard

Open Sauced

@open-sauced/conventional-commit

Never miss a conventional commit with commitizen running on npx.

Commits Issues Releases Discord Twitter

📦 Install

This package is binary and doesn't require installation however you can add it to your repository as a devDependency:

npm install --save-dev @open-sauced/conventional-commit
Enter fullscreen mode Exit fullscreen mode

🚀 Usage

All you have to do is run the script next to your package.json:

npx @open-sauced/conventional-commit
# or
npx conventional-commit
Enter fullscreen mode Exit fullscreen mode

🔧 Configuration

The most common use case for this package is to run it instead of the git commit command inside your npm scripts:

{
  "scripts": {
    "push": "npx @open-sauced/conventional-commit"
  }
}
Enter fullscreen mode Exit fullscreen mode

or

{
  "scripts": {
    "push": "npx conventional-commit"
  }
}
Enter fullscreen mode Exit fullscreen mode

If you want to ensure local-only usage:

{
  "scripts": {
    "push": "conventional-commit"
  }
}
Enter fullscreen mode Exit fullscreen mode

🤝 Contributing

We encourage you to contribute to Open Sauced! Please check out the Contributing guide for guidelines about how to proceed.

If…

Yaml file link:
@open-sauced/open-sauced/.github/workflows/compliance.yml

Additional Resources / Info

Here are all the open source actions we are using to power this compliance workflow:

Be sure to include the DEV usernames of your collaborators:

Top comments (0)