Categorygithub.com/nyambati/drone-pr-checker
repositorypackage
1.0.0
Repository: https://github.com/nyambati/drone-pr-checker.git
Documentation: pkg.go.dev

# README

Drone Pull Request Checker Plugin

Drone plugin to run various checks on the Pull request as part of review process

IMPORTANT: This plugin is under development and the parameters are subject to change

Usage

The following settings changes this plugin's behavior,

PropertyTypeDefault
prefixesstring""
regexpstring""
skipOnLabelsstring""
ignoreGithubErrorbooleanfalse
checklistbooleanfalse
checklistTitlestring## Checklist
  • prefixes: The accepted pull request title prefixes.
  • regexp: The regular expression for a valid pull request title.
  • skipOnLabels: The labelat which the checks will be disabled.
  • ignoreGithubError: Ignores github error when fetching Pull request labels and checklist.
  • checklist: Ensures that all checklist items are checked.
  • checklistTitle: The title used to find the checklist.

Credentials

  • github_token: This will be used to fetch pull request labels and content from github.

Pipeline

kind: pipeline
type: docker
name: default

steps:
  - name: check pull request
    image: thomasnyambati/drone-pr-checker
    settings:
      prefixes:
      regexp:
      skipOnLabels:
      ignoreGithubError:
      checklist:
      checklistTitle:
    environment:
      GITHUB_TOKEN:
        from_secret: github_token

Now load the image using the command,

docker load < ./dist/hello-world-0.0.1_$(uname -m).tar

Building Plugin

The plugin build relies on:

Build plugin

make build

Testing

Build plugin packages,

make test

Build plugin container image,

make build

Create .env

cat<<EOF | tee .env
PLUGIN_PREFIXES="feat:,chore:,hotfix:"
PLUGIN_REGEXP="^(chore|hotfix|docs):.+"
PLUGIN_SKIP_ON_LABELS="skip"
PLUGIN_IGNORE_GITHUB_ERROR="false"
PLUGIN_CHECKLIST="true"
PLUGIN_CHECKLIST_TITLE="## Checklist"
DRONE_PULL_REQUEST_TITLE="feat: sample pull request"
EOF

Run the plugin

docker run --rm \
  --env-file=.env \
  --volume "$PWD:/workspace" \
  thomasnyambati/drone-pr-checker:latest