Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
fetch-depth: 0

repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}

- uses: actions/setup-node@v3
with:
node-version: 16
Expand All @@ -40,7 +41,10 @@ jobs:

- name: Build
run: yarn build


- name: Add & Commit
uses: EndBug/add-and-commit@v9.1.3

- name: Test Action Lowercase
id: lowercase
uses: ./ # Uses an action in the root directory
Expand Down
26 changes: 22 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/operations/kebabcase.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function kebabcase(str: string): string {
return str.replace(/([a-z])([A-Z])/g, "$1-$2")
.replace(/[\s_/]+/g, '-')
.toLowerCase().replace('/', '-');
.toLowerCase();
}
12 changes: 6 additions & 6 deletions src/run.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as core from "@actions/core";
import {lowercase} from "./operations/lowercase";
import {uppercase} from "./operations/uppercase";
import {kebabcase} from "./operations/kebabcase";
import {dnsSubdomain} from "./operations/dns-subdomain";
import { lowercase } from "./operations/lowercase";
import { uppercase } from "./operations/uppercase";
import { kebabcase } from "./operations/kebabcase";
import { dnsSubdomain } from "./operations/dns-subdomain";

export async function run() {
try {
Expand All @@ -23,10 +23,10 @@ export async function run() {
outputString = kebabcase(inputString);
break;
case "dns-subdomain":
outputString = dnsSubdomain(inputString, maxLength)
outputString = dnsSubdomain(inputString, maxLength);
break;
default:
core.setFailed(`Invalid operation: ${operation}`)
core.setFailed(`Invalid operation: ${operation}`);
}

if (maxLength > 0 && outputString.length > maxLength) {
Expand Down