Skip to content

Action String Formatter

Actions
Github Action to convert strings using pure python3
v1.0.0
Latest
Star (0)

Tags

 (1)

change-string-case-action-min-dependencies

Github Action: Make a string lowercase, uppercase, or capitalized

this runs in pure python without any additional packages or dependencies!

Change String Case GitHub Action

This action accepts any string, and outputs three different versions of that string:

  • lowercase (XyZzY -> xyzzy)
  • uppercase (XyZzY -> XYZZY)
  • capitalized (Xyzzy -> Xyzzy)
  • dashnormalized (Xy.ZzY -> xy-zzy)

You can access the outputted strings through the job outputs context. See docs here, or the Example Usage section below.

Inputs

string

Required The string you want manipulated

Outputs

lowercase

lowercase="${{ inputs.string }}".lower()

Example: XyZzY -> xyzzy

uppercase

uppercase="${{ inputs.string }}".upper()

Example: XyZzY -> XYZZY

capitalized

lowercase="${{ inputs.string }}".lower()
uppercase="${{ inputs.string }}".upper()
capitalized=f'{uppercase[:1]}{lowercase[1:]}'

Example: XyZzY -> Xyzzy

dashnormalized

lowercase="${{ inputs.string }}".lower()
dashnormalized=''.join(x if x.isalnum() else '-' for x in lowercase)

Example: Xy.ZzY -> xy-zzy

afterlastdash

afterlastdash="${{ inputs.string }}".split("/")[-1]

lowerlastdash

lowerlastdash="${{ inputs.string }}".split("/")[-1].lower()

Example Usage

name: SomeWorkflow
jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - id: string
        uses: Entepotenz/change-string-case-action-min-dependencies@v1
        with:
          string: XyZzY
      - id: step2
        run: echo ${{ steps.string.outputs.lowercase }}
      - id: step3
        run: echo ${{ steps.string.outputs.uppercase }}
      - id: step4
        run: echo ${{ steps.string.outputs.capitalized }}
      - id: step5
        run: echo ${{ steps.string.outputs.dashnormalized }}
      - id: step6
        run: echo ${{ steps.string.outputs.afterlastdash }}
      - id: step7
        run: echo ${{ steps.string.outputs.lowerlastdash }}

Action String Formatter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Github Action to convert strings using pure python3
v1.0.0
Latest

Tags

 (1)

Action String Formatter is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.