Skip to content

Commit 67cd58a

Browse files
chore: initial release
1 parent cad4f60 commit 67cd58a

File tree

12 files changed

+10582
-1
lines changed

12 files changed

+10582
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release GitHub Actions
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag for the release"
8+
required: true
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release:
15+
permissions:
16+
actions: read
17+
id-token: write
18+
contents: write
19+
uses: step-security/reusable-workflows/.github/workflows/actions_release.yaml@v1
20+
with:
21+
tag: "${{ github.event.inputs.tag }}"

.github/workflows/main.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
on: [push]
2+
3+
jobs:
4+
find-and-replace-job:
5+
runs-on: ubuntu-latest
6+
name: 'Find and replace on a string'
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v4
10+
- name: Run find-and-replace to remove refs/heads/
11+
uses: ./
12+
id: findandreplace
13+
with:
14+
source: ${{ github.ref }}
15+
find: 'refs/heads/'
16+
replace: ''
17+
- name: Get the above output
18+
run: echo "The replaced value is ${{ steps.findandreplace.outputs.value }}"
19+
- name: Run find-and-replace to remove slashes
20+
uses: ./
21+
id: findandreplace2
22+
with:
23+
source: ${{ steps.findandreplace.outputs.value }}
24+
find: '/'
25+
replace: '-'
26+
- name: Get the final output
27+
run: echo "The replaced value is ${{ steps.findandreplace2.outputs.value }}"

.gitignore

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
jspm_packages/
42+
43+
# Snowpack dependency directory (https://snowpack.dev/)
44+
web_modules/
45+
46+
# TypeScript cache
47+
*.tsbuildinfo
48+
49+
# Optional npm cache directory
50+
.npm
51+
52+
# Optional eslint cache
53+
.eslintcache
54+
55+
# Microbundle cache
56+
.rpt2_cache/
57+
.rts2_cache_cjs/
58+
.rts2_cache_es/
59+
.rts2_cache_umd/
60+
61+
# Optional REPL history
62+
.node_repl_history
63+
64+
# Output of 'npm pack'
65+
*.tgz
66+
67+
# Yarn Integrity file
68+
.yarn-integrity
69+
70+
# dotenv environment variables file
71+
.env
72+
.env.test
73+
74+
# parcel-bundler cache (https://parceljs.org/)
75+
.cache
76+
.parcel-cache
77+
78+
# Next.js build output
79+
.next
80+
out
81+
82+
# Nuxt.js build / generate output
83+
.nuxt
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and not Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
# Stores VSCode versions used for testing VSCode extensions
107+
.vscode-test
108+
109+
# yarn v2
110+
.yarn/cache
111+
.yarn/unplugged
112+
.yarn/build-state.yml
113+
.yarn/install-state.gz
114+
.pnp.*
115+
.idea
116+
117+
node_modules/

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2023 StepSecurity
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,42 @@
1-
# actions-find-and-replace-string
1+
# Find and replace strings
2+
3+
This action executes find-and-replace on a given string (hint: use `${{ github.ref }}` to get your branch name and apply this on it for use in another action).
4+
5+
## Inputs
6+
7+
### `source`
8+
9+
**Required** The source string to apply this action to
10+
11+
### `find`
12+
13+
**Required** The text you want to search for within the branch name (eg. `ref/heads/`)
14+
15+
### `replace`
16+
17+
**Required** The text you want to replace (eg. `head-`, ``, `root_`)
18+
19+
### `replaceAll`
20+
21+
**Optional** Should replace all occurrences? (only 'true' string will be interpreted positive)
22+
23+
## Outputs
24+
25+
### `value`
26+
27+
The new value containing the found-and-replaced string.
28+
29+
### Example usage
30+
31+
```yaml
32+
uses: step-security/actions-find-and-replace-string@v5
33+
with:
34+
source: ${{ github.ref }} # this translates to ref/heads/main on the main branch, but can be any arbitrary string
35+
find: 'ref/heads/' # we want to remove ref/heads/ from source
36+
replace: '' # and replace it with a blank string (ie. removing it)
37+
```
38+
39+
This will output `main`.
40+
41+
Check out `.github/workflows/main.yml` for more examples
42+

SECURITY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
5+
Please report security vulnerabilities to [email protected]

action.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: 'Find-and-replace strings'
2+
description: 'Finds and replaces text on a string'
3+
branding:
4+
color: purple
5+
icon: copy
6+
inputs:
7+
source:
8+
description: 'The text you want to run this action on'
9+
required: true
10+
find:
11+
description: 'The text you are looking for'
12+
required: true
13+
replace:
14+
description: 'The text you want to replace with'
15+
required: true
16+
replaceAll:
17+
description: 'Replace all occurrences?'
18+
required: false
19+
outputs:
20+
value:
21+
description: 'The new value after find-and-replace has been run'
22+
runs:
23+
using: 'node20'
24+
main: 'dist/index.js'

0 commit comments

Comments
 (0)