Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nchiasson-dgi committed Jun 1, 2023
0 parents commit 3d0c497
Show file tree
Hide file tree
Showing 14 changed files with 13,165 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
}
}
15 changes: 15 additions & 0 deletions .github/workflows/action-major-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Action Major Tag
on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
workflow_dispatch:

jobs:
new-major-tag:
runs-on: ubuntu-latest
steps:
- name: Run Action Major Tagger
uses: discoverygarden/action-major-tag@main
with:
prefix: v
17 changes: 17 additions & 0 deletions .github/workflows/enforce-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Enforce Labeling
on:
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
workflow_dispatch:

jobs:
check_labels:
runs-on: ubuntu-latest
steps:
- name: Check Pull Request Labels
uses: discoverygarden/enforce-label@main
with:
required_labels: major,minor,patch,no-update
17 changes: 17 additions & 0 deletions .github/workflows/semver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Semantic Version tagger
on:
pull_request_target:
types: closed
branches:
- main
jobs:
update:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
- name: Run Semantic Version tagging action
uses: discoverygarden/auto-semver@v1
- name: Update Major Tag
uses: discoverygarden/action-major-tag@main
with:
prefix: 'v'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Enforce Labels

A Github action to enforce labeling a pull request with specified labels.

## Inputs
- **required_labels:** A list of labels that at least one is required on the pull request.

## Outputs
Currently there are no outputs defined for this workflow.

## Secrets
This action does not use any secrets.

## Usage
Learn more about GitHub Actions in general [here](https://docs.github.com/en/actions/quickstart).

To use this action in your repo, follow these steps:

1. Create a YAML file in the `.github/workflows/` directory of your repo.
2. Copy the following into the YAML file:
```yaml
---
name: Enforce Labeling
on:
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
workflow_dispatch:

jobs:
check_labels:
runs-on: ubuntu-latest
steps:
- name: Check Pull Request Labels
uses: discoverygarden/enforce-label@main
with:
required_labels: major,minor,patch,no-update
```
The labels provided in this case are our typical semantic version tagging labels, as well as a `no-update` label that will not initiate the semantic tagging workflow, in the rare case we don't want to initiate the workoflow.

The `types` on the `pull_request_target` are the base conditions `[opened, synchronize, reopened]` as well as two scenarios `[labeled, unlabeled]` which we want to track as we're specifically dealing with labels.
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Enforce Label'
description: 'Bump the major version reference tag for the action.'
inputs:
required_labels:
description: 'A list of labels that at least one is required on the pull request.'
required: true
runs:
using: 'node16'
main: 'dist/index.js'
branding:
icon: 'tag'
color: 'purple'
Loading

0 comments on commit 3d0c497

Please sign in to comment.