Test Action (Replace Tokens) #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test Action (Replace Tokens) | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
node-version: [ 18.x ] | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set Up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Replace Tokens | |
uses: abhinavminhas/replace-tokens@main | |
with: | |
files: package.json | |
replacements: true=false | |
- name: Install (Clean), Build & Test | |
run: | | |
npm ci | |
npm run build --if-present | |
npm test | |
# Readme Examples | |
- name: Replace Tokens ( <<<< Example 1 - Replace a token in a file. >>>> ) | |
uses: abhinavminhas/replace-tokens@main | |
with: | |
files: ./test/test-files/single_file_replace_single_token.txt | |
replacements: .=? | |
- name: Replace Tokens ( <<<< Example 2 - Replace multiple tokens in a file. >>>> ) | |
uses: abhinavminhas/replace-tokens@main | |
with: | |
files: ./test/test-files/single_file_replace_multiple_different_tokens.txt | |
replacements: Hello=Hi, ....=? | |
- name: Replace Tokens ( <<<< Example 3 - Replace a token in multiple files. >>>> ) | |
uses: abhinavminhas/replace-tokens@main | |
with: | |
files: | | |
./test/test-files/multiple_files_single_token/file1.json, ./test/test-files/multiple_files_single_token/file2.csv, | |
./test/test-files/multiple_files_single_token/file3.yml, ./test/test-files/multiple_files_single_token/file4.txt | |
replacements: 54c213d6-ac7f-44cb-8ac2-91e6a175af3d=18c11372-3b9a-49e1-98d1-6afafc247758 | |
- name: Replace Tokens ( <<<< Example 4 - Replace multiple tokens in multiple files. >>>> ) | |
uses: abhinavminhas/replace-tokens@main | |
with: | |
files: | | |
./test/test-files/multiple_files_mutiple_tokens/file1.json, ./test/test-files/multiple_files_mutiple_tokens/file2.csv, | |
./test/test-files/multiple_files_mutiple_tokens/file3.yml, ./test/test-files/multiple_files_mutiple_tokens/file4.txt | |
replacements: 54c213d6-ac7f-44cb-8ac2-91e6a175af3d=f859e2ad-2c56-40e5-9ead-539095ba6acd, 323acd81-6a1f-4eb8-bc6c-22a7711ab8ba=e10b5211-5fdb-4224-bb81-714bd3759c71 | |
- name: Replace Tokens ( <<<< Example 5 - Use a different separator than comma. >>>> ) | |
uses: abhinavminhas/replace-tokens@main | |
with: | |
files: | | |
./test/test-files/multiple_files_mutiple_tokens/file1.json | ./test/test-files/multiple_files_mutiple_tokens/file2.csv | | |
./test/test-files/multiple_files_mutiple_tokens/file3.yml | ./test/test-files/multiple_files_mutiple_tokens/file4.txt | |
replacements: f859e2ad-2c56-40e5-9ead-539095ba6acd=54c213d6-ac7f-44cb-8ac2-91e6a175af3d | e10b5211-5fdb-4224-bb81-714bd3759c71=323acd81-6a1f-4eb8-bc6c-22a7711ab8ba | |
delimiter: '|' | |