-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
chore: add press, page, and categories with url fixes
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
./bin/search_and_replace.sh public\/blog "\/wp\-content" "https\:\/\/pages\.near\.org\/wp\-content" | ||
./bin/search_and_replace.sh public\/blog "\=\"\/wp\-content" "\=\"https\:\/\/pages\.near\.org\/wp-content" | ||
./bin/search_and_replace.sh public\/blog "\/wp\-includes" "https\:\/\/pages\.near\.org\/wp\-includes" | ||
./bin/search_and_replace.sh public\/blog "\?paged\=" "page\/" | ||
./bin/search_and_replace.sh public\/blog\/near-foundation-announces-policy-principles "\=https\:\/\/s3\-eu\-west\-2\.amazonaws\.com\/lawcom\-prod\-storage\-11jsxou24uy7q\/uploads\/2022\/07\/Digital\-Assets\-Consultation\-Paper\-Law\-Commission\-1\.pdf" "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Check if correct number of arguments are provided | ||
if [ "$#" -ne 3 ]; then | ||
echo "Usage: $0 <directory> <search_string> <replacement_string>" | ||
exit 1 | ||
fi | ||
|
||
directory="$1" | ||
search_string="$2" | ||
replacement_string="$3" | ||
|
||
# Check if directory exists | ||
if [ ! -d "$directory" ]; then | ||
echo "Error: Directory '$directory' not found." | ||
exit 1 | ||
fi | ||
|
||
# Perform search and replace recursively | ||
echo "Searching for '$search_string' and replacing with '$replacement_string' in files under '$directory'..." | ||
|
||
# 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" | ||
# 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" | ||
echo "Modified: $file" | ||
done | ||
|
||
echo "Search and replace complete." |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.