Skip to content

Commit e78ec52

Browse files
authored
initial operations (#4)
initial operations: - `lowercase` - `uppercase` - `kebabcase` - `dns-subdomain` which is kebabcase + 63 letter maximum. --------- Co-authored-by: Benbentwo <[email protected]>
1 parent 9bf7501 commit e78ec52

File tree

18 files changed

+360
-137
lines changed

18 files changed

+360
-137
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
on:
2+
workflow_dispatch:
3+
pull_request:
4+
5+
permissions:
6+
pull-requests: write
7+
deployments: write
8+
id-token: write
9+
contents: read
10+
11+
jobs:
12+
build:
13+
runs-on: ["self-hosted"]
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
ref: ${{ github.ref }}
18+
fetch-depth: 0
19+
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
24+
- name: Run install
25+
uses: borales/actions-yarn@v4
26+
with:
27+
cmd: install # will run `yarn install` command
28+
29+
- name: Install Dependencies
30+
run: yarn --frozen-lockfile --prefer-offline
31+
32+
- name: Linting
33+
run: yarn lint
34+
35+
- name: Format Source Code
36+
run: yarn format
37+
38+
- name: Unit Tests
39+
run: yarn test
40+
41+
- name: Build
42+
run: yarn build
43+
44+
- name: Test Action Lowercase
45+
id: lowercase
46+
uses: ./ # Uses an action in the root directory
47+
with:
48+
operation: 'lowercase'
49+
input-string: 'Hello World'
50+
51+
- name: Test Action UpperCase
52+
id: uppercase
53+
uses: ./ # Uses an action in the root directory
54+
with:
55+
operation: 'uppercase'
56+
input-string: 'Hello World'
57+
58+
- name: Test Action Kebabcase
59+
id: kebabcase
60+
uses: ./ # Uses an action in the root directory
61+
with:
62+
operation: 'kebabcase'
63+
input-string: 'Hello World'
64+
65+
- name: Test Action DNS Subdomain
66+
id: dns-subdomain
67+
uses: ./ # Uses an action in the root directory
68+
with:
69+
operation: 'dns-subdomain'
70+
input-string: 'HelloWorldFromSomeReallyLongStringThatWillBeTruncatedUsingTheMaxLengthOption'
71+
72+
- name: Test Action Invalid Operation
73+
id: invalid-operation
74+
uses: ./ # Uses an action in the root directory
75+
continue-on-error: true
76+
with:
77+
operation: 'invalid-operation'
78+
input-string: 'Hello World'
79+
80+
- name: Check Outputs
81+
if: ${{ steps.get_line_rate.outputs.lineRate < 0.9 }}
82+
uses: actions/github-script@v3
83+
with:
84+
script: |
85+
if('${{steps.lowercase.outputs.output-string}}' !== 'hello world') {
86+
core.setFailed('Lowercase test failed')
87+
}
88+
89+
if('${{steps.uppercase.outputs.output-string}}' !== 'HELLO WORLD') {
90+
core.setFailed('Uppercase test failed')
91+
}
92+
93+
if('${{steps.kebabcase.outputs.output-string}}' !== 'hello-world') {
94+
core.setFailed('Kebabcase test failed')
95+
}
96+

README.md

Lines changed: 59 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
<!-- markdownlint-disable -->
3-
# github-action-typescript-template [![Latest Release](https://img.shields.io/github/release/cloudposse/github-action-typescript-template.svg)](https://github.com/cloudposse/github-action-typescript-template/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
3+
# github-action-string-transformer [![Latest Release](https://img.shields.io/github/release/cloudposse/github-action-string-transformer.svg)](https://github.com/cloudposse/github-action-string-transformer/releases/latest) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)
44
<!-- markdownlint-restore -->
55

66
[![README Header][readme_header_img]][readme_header_link]
@@ -28,7 +28,7 @@
2828
2929
-->
3030

31-
Template repo for GitHub Actions written in TypeScript
31+
A helper for transforming strings in GitHub Actions
3232

3333
---
3434

@@ -54,22 +54,45 @@ It's 100% Open Source and licensed under the [APACHE2](LICENSE).
5454

5555

5656

57-
58-
5957
## Introduction
6058

61-
This repo is a template for GitHub Actions written in TypeScript.
59+
This is a GitHub Action that can be used to transform strings in GitHub Actions.
6260

6361

6462

6563

6664

6765
## Usage
6866

67+
```yaml
68+
- name: Action Lowercase
69+
id: lowercase
70+
uses: ./ # Uses an action in the root directory
71+
with:
72+
operation: 'lowercase'
73+
input-string: 'Hello World'
74+
75+
- name: Action UpperCase
76+
id: uppercase
77+
uses: ./ # Uses an action in the root directory
78+
with:
79+
operation: 'uppercase'
80+
input-string: 'Hello World'
81+
82+
- name: Action Kebabcase
83+
id: kebabcase
84+
uses: ./ # Uses an action in the root directory
85+
with:
86+
operation: 'kebabcase'
87+
input-string: 'Hello World'
88+
```
6989

90+
Then Fetch the result with:
7091

71-
Use this repository as a template in your own GitHub Action project to get started.
72-
92+
```yaml
93+
- name: Get the output
94+
run: echo "The output was ${{ steps.lowercase.outputs.output-string }}"
95+
```
7396

7497

7598

@@ -81,7 +104,7 @@ Use this repository as a template in your own GitHub Action project to get start
81104

82105
## Share the Love
83106

84-
Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/github-action-typescript-template)! (it helps us **a lot**)
107+
Like this project? Please give it a ★ on [our GitHub](https://github.com/cloudposse/github-action-string-transformer)! (it helps us **a lot**)
85108

86109
Are you using this project or any of our other projects? Consider [leaving a testimonial][testimonial]. =)
87110

@@ -105,7 +128,7 @@ For additional context, refer to some of these links.
105128

106129
**Got a question?** We got answers.
107130

108-
File a GitHub [issue](https://github.com/cloudposse/github-action-typescript-template/issues), send us an [email][email] or join our [Slack Community][slack].
131+
File a GitHub [issue](https://github.com/cloudposse/github-action-string-transformer/issues), send us an [email][email] or join our [Slack Community][slack].
109132

110133
[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
111134

@@ -153,7 +176,7 @@ Sign up for [our newsletter][newsletter] that covers everything on our technolog
153176

154177
### Bug Reports & Feature Requests
155178

156-
Please use the [issue tracker](https://github.com/cloudposse/github-action-typescript-template/issues) to report any bugs or file feature requests.
179+
Please use the [issue tracker](https://github.com/cloudposse/github-action-string-transformer/issues) to report any bugs or file feature requests.
157180

158181
### Developing
159182

@@ -241,33 +264,33 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
241264
[![Beacon][beacon]][website]
242265
<!-- markdownlint-disable -->
243266
[logo]: https://cloudposse.com/logo-300x69.svg
244-
[docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=docs
245-
[website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=website
246-
[github]: https://cpco.io/github?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=github
247-
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=jobs
248-
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=hire
249-
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=slack
250-
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=linkedin
251-
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=twitter
252-
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=testimonial
253-
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=office_hours
254-
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=newsletter
255-
[discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=discourse
256-
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=email
257-
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=commercial_support
258-
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=we_love_open_source
259-
[terraform_modules]: https://cpco.io/terraform-modules?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=terraform_modules
267+
[docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=docs
268+
[website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=website
269+
[github]: https://cpco.io/github?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=github
270+
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=jobs
271+
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=hire
272+
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=slack
273+
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=linkedin
274+
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=twitter
275+
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=testimonial
276+
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=office_hours
277+
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=newsletter
278+
[discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=discourse
279+
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=email
280+
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=commercial_support
281+
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=we_love_open_source
282+
[terraform_modules]: https://cpco.io/terraform-modules?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=terraform_modules
260283
[readme_header_img]: https://cloudposse.com/readme/header/img
261-
[readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=readme_header_link
284+
[readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=readme_header_link
262285
[readme_footer_img]: https://cloudposse.com/readme/footer/img
263-
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=readme_footer_link
286+
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=readme_footer_link
264287
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
265-
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-typescript-template&utm_content=readme_commercial_support_link
266-
[share_twitter]: https://twitter.com/intent/tweet/?text=github-action-typescript-template&url=https://github.com/cloudposse/github-action-typescript-template
267-
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=github-action-typescript-template&url=https://github.com/cloudposse/github-action-typescript-template
268-
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/github-action-typescript-template
269-
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/github-action-typescript-template
270-
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/github-action-typescript-template
271-
[share_email]: mailto:?subject=github-action-typescript-template&body=https://github.com/cloudposse/github-action-typescript-template
272-
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/github-action-typescript-template?pixel&cs=github&cm=readme&an=github-action-typescript-template
288+
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/github-action-string-transformer&utm_content=readme_commercial_support_link
289+
[share_twitter]: https://twitter.com/intent/tweet/?text=github-action-string-transformer&url=https://github.com/cloudposse/github-action-string-transformer
290+
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=github-action-string-transformer&url=https://github.com/cloudposse/github-action-string-transformer
291+
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/github-action-string-transformer
292+
[share_facebook]: https://facebook.com/sharer/sharer.php?u=https://github.com/cloudposse/github-action-string-transformer
293+
[share_googleplus]: https://plus.google.com/share?url=https://github.com/cloudposse/github-action-string-transformer
294+
[share_email]: mailto:?subject=github-action-string-transformer&body=https://github.com/cloudposse/github-action-string-transformer
295+
[beacon]: https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse/github-action-string-transformer?pixel&cs=github&cm=readme&an=github-action-string-transformer
273296
<!-- markdownlint-restore -->

README.yaml

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
#
66

77
# Name of this project
8-
name: github-action-typescript-template
8+
name: github-action-string-transformer
99

1010
# Tags of this project
1111
tags:
1212
- github-action
1313
- typescript
14-
- template
1514

1615
# Logo for this project
1716
#logo: docs/logo.png
@@ -20,24 +19,27 @@ tags:
2019
license: "APACHE2"
2120

2221
# Canonical GitHub repo
23-
github_repo: cloudposse/github-action-typescript-template
22+
github_repo: cloudposse/github-action-string-transformer
23+
24+
config: {}
2425

2526
# Badges to display
2627
badges:
2728
- name: "Latest Release"
28-
image: "https://img.shields.io/github/release/cloudposse/github-action-typescript-template.svg"
29-
url: "https://github.com/cloudposse/github-action-typescript-template/releases/latest"
29+
image: "https://img.shields.io/github/release/cloudposse/github-action-string-transformer.svg"
30+
url: "https://github.com/cloudposse/github-action-string-transformer/releases/latest"
3031
- name: "Slack Community"
3132
image: "https://slack.cloudposse.com/badge.svg"
3233
url: "https://slack.cloudposse.com"
3334

3435
related: []
3536

3637
# Short description of this project
37-
description: Template repo for GitHub Actions written in TypeScript
38+
description: |
39+
A helper for transforming strings in GitHub Actions
3840
3941
introduction: |-
40-
This repo is a template for GitHub Actions written in TypeScript.
42+
This is a GitHub Action that can be used to transform strings in GitHub Actions.
4143
references:
4244
- name: "github-actions-workflows"
4345
description: "Reusable workflows for different types of projects"
@@ -48,11 +50,40 @@ references:
4850

4951
# How to use this project
5052
usage: |
51-
Use this repository as a template in your own GitHub Action project to get started.
53+
54+
```yaml
55+
- name: Action Lowercase
56+
id: lowercase
57+
uses: ./ # Uses an action in the root directory
58+
with:
59+
operation: 'lowercase'
60+
input-string: 'Hello World'
61+
62+
- name: Action UpperCase
63+
id: uppercase
64+
uses: ./ # Uses an action in the root directory
65+
with:
66+
operation: 'uppercase'
67+
input-string: 'Hello World'
68+
69+
- name: Action Kebabcase
70+
id: kebabcase
71+
uses: ./ # Uses an action in the root directory
72+
with:
73+
operation: 'kebabcase'
74+
input-string: 'Hello World'
75+
```
76+
77+
Then Fetch the result with:
78+
79+
```yaml
80+
- name: Get the output
81+
run: echo "The output was ${{ steps.lowercase.outputs.output-string }}"
82+
```
5283
5384
include:
5485

5586
# Contributors to this project
5687
contributors:
57-
- name: "Matt Calhoun"
58-
github: "mcalhoun"
88+
- name: "Benjamin Smith"
89+
github: "Benbentwo"

0 commit comments

Comments
 (0)