Skip to content

Commit

Permalink
Different improvements
Browse files Browse the repository at this point in the history
- upgraded node to 16 so that String.replaceAll is supported
- added description of replaceAll input into readme and action.yml
- updaged @actions/core, removed @actions/github
- changed way output is set because core.setOutput is deprecated
  • Loading branch information
mbarouski committed Nov 10, 2022
1 parent 1a1efe2 commit 84f77c4
Show file tree
Hide file tree
Showing 439 changed files with 4,943 additions and 86,466 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
12
16
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -16,6 +16,10 @@ This action executes find-and-replace on a given string (hint: use `${{ github.r

**Required** The text you want to replace (eg. `head-`, ``, `root_`)

### `replaceAll`

**Optional** Should replace all occurrences? (only 'true' string will be interpreted positive)

## Outputs

### `value`
Expand Down
7 changes: 5 additions & 2 deletions action.yml
@@ -1,6 +1,6 @@
name: 'Find-and-replace strings'
description: 'Finds and replaces text on a string'
author: "Kishyr Ramdial"
author: 'Kishyr Ramdial'
branding:
color: purple
icon: copy
Expand All @@ -14,9 +14,12 @@ inputs:
replace:
description: 'The text you want to replace with'
required: true
replaceAll:
description: 'Replace all occurrences?'
required: false
outputs:
value:
description: 'The new value after find-and-replace has been run'
runs:
using: 'node12'
using: 'node16'
main: 'index.js'
6 changes: 3 additions & 3 deletions index.js
@@ -1,14 +1,14 @@
const core = require('@actions/core')
const github = require('@actions/github')
const fs = require('fs')

try {
const source = core.getInput('source')
const find = core.getInput('find')
const replace = core.getInput('replace')
const replaceAllInput = core.getInput('replaceAll')
const replaceAll = replaceAllInput ? replaceAllInput == 'true' : false
const branchName = replaceAll ? source.replaceAll(find, replace) : source.replace(find, replace)
core.setOutput('value', branchName)
const resultValue = replaceAll ? source.replaceAll(find, replace) : source.replace(find, replace)
fs.writeFileSync(process.env.GITHUB_OUTPUT, `value=${resultValue}\n`)
} catch (error) {
core.setFailed(error.message)
}
1 change: 1 addition & 0 deletions node_modules/.bin/uuid

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

41 changes: 41 additions & 0 deletions node_modules/.package-lock.json

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

200 changes: 194 additions & 6 deletions node_modules/@actions/core/README.md

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

3 changes: 1 addition & 2 deletions node_modules/@actions/core/lib/command.d.ts

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

17 changes: 15 additions & 2 deletions node_modules/@actions/core/lib/command.js

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

2 changes: 1 addition & 1 deletion node_modules/@actions/core/lib/command.js.map

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

0 comments on commit 84f77c4

Please sign in to comment.