diff --git a/.github/workflows/fix_paths.yml b/.github/workflows/fix_paths.yml new file mode 100644 index 00000000..56e6e42b --- /dev/null +++ b/.github/workflows/fix_paths.yml @@ -0,0 +1,30 @@ +on: + push: + branches: [develop] +permissions: + contents: write + +jobs: + fix-paths: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: script + shell: bash + run: ./bin/replace_all.sh + + - name: Check the diff + id: check_diff + run: | + git diff --quiet . || echo "changed=true" >> $GITHUB_OUTPUT + + - name: Log next steps + if: steps.check_diff.outputs.changed != 'true' + run: | + echo "Workflow detected that no changes are needed." + + - name: create pull request + if: steps.check_diff.outputs.changed == 'true' + run: gh pr create -B base_branch -H branch_to_merge -m 'auto-update URL paths in response to marketing content update' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/bin/search_and_replace.sh b/bin/search_and_replace.sh index 2d29415b..3a254880 100755 --- a/bin/search_and_replace.sh +++ b/bin/search_and_replace.sh @@ -22,10 +22,10 @@ echo "Searching for '$search_string' and replacing with '$replacement_string' in # Use find command to search for files recursively in the directory find "$directory" -type f -print0 | while IFS= read -r -d '' file; do # Perform the search and replace using sed - #sed -i 's/'$search_string'/'$replacement_string'/g' "$file" + sed -i 's/'$search_string'/'$replacement_string'/g' "$file" # Note: the above sed command works on unix/linux, but not on MacOS # To run this script locally on a mac, comment out the above and use the line below - sed -i '' 's/'$search_string'/'$replacement_string'/g' "$file" + # sed -i '' 's/'$search_string'/'$replacement_string'/g' "$file" echo "Modified: $file" done