Skip to content

Commit

Permalink
Modernize GH Action and add Label feature
Browse files Browse the repository at this point in the history
  • Loading branch information
bbredewold committed Feb 11, 2024
1 parent cbd7f9e commit 8f1225c
Show file tree
Hide file tree
Showing 12 changed files with 32,702 additions and 6,331 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/fix-pull-request-titles.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

name: Clean up PR title
name: Update PR details

on:
pull_request:
Expand All @@ -8,12 +7,13 @@ on:
- edited

jobs:
fix-titels:
name: Clean up PR titles
fix-pr:
name: Update PR details
runs-on: ubuntu-latest

steps:
- name: Update PR title
uses: motivozwolle/fix-title@master
- name: Update PR
uses: sibizwolle/fix-title@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
label: true
8 changes: 4 additions & 4 deletions .github/workflows/rebuild-dist-on-push-to-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '12'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand All @@ -36,7 +36,7 @@ jobs:
npm run build
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: 'Compiled action using GitHub Actions'
file_pattern: 'dist/*'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '12'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
entry: './node_modules/.bin/eslint --fix'
files: resources/js/.*\.(js)$

- repo: https://github.com/motivozwolle/pre-commit-hooks
- repo: https://github.com/sibizwolle/pre-commit-hooks
rev: v1.0.2
hooks:
- id: add-ticket-to-commit
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)
=====================

Copyright © 2021 Motivo B.V.
Copyright © 2021 Sibi B.V.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Fix PR titles
# Update PR

This action fixes titles of Pull Requests, by performing a few actions:
This action updates Pull Requests, by performing a few actions:

- Determine project from branch name (`proj-22`, `feature/proj-22`, `feature/proj-22-steve` and alike)
- Remove any duplicate occurances of the project code from the title
- Remove prefixes like `Feature/` auto-created by GitHub sometimes
- Convert title to Title Case (`My pull request``My Pull Request`)
- Prefix the project code in brackets (`[PROJ-22]`)

If the only changes are casing, no changes are made.
- If a label exists with the prefix, it adds the label to the PR.

## Installation

Expand All @@ -17,7 +16,7 @@ To add it to your project, create a new workflow that triggers on PR creation an
For example, this could look like this:

```yaml
name: Clean up PR title
name: Update PR details

on:
pull_request:
Expand All @@ -26,13 +25,14 @@ on:
- edited

jobs:
fix-titels:
name: Clean up PR titles
fix-pr:
name: Update PR details
runs-on: ubuntu-latest

steps:
- name: Update PR title
uses: motivozwolle/fix-title@master
- name: Update PR
uses: sibizwolle/fix-title@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }},
label: true

8 changes: 6 additions & 2 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Clean up PR title

author: Motivo B.V.
author: Sibi B.V.

description: |
Cleans up pull requests titles and adds Jira ticket numbers
Expand All @@ -13,9 +13,13 @@ inputs:
description: Ticket number to override
required: false
default: ''
label:
description: Defines if the PR should be labeled
required: false
default: true

runs:
using: 'node12'
using: 'node20'
main: 'dist/index.js'

branding:
Expand Down
Loading

0 comments on commit 8f1225c

Please sign in to comment.