Skip to content

Commit

Permalink
Update update_urls.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mashiahd authored Jun 24, 2024
1 parent 7e829ee commit d1673dd
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/update_urls.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
name: Update URLs after rebase
name: Update URLs based on branch

on:
push:
branches:
- main
- develop

jobs:
update-urls:
runs-on: ubuntu-latest

steps:
- name: Checkout develop branch
- name: Checkout repository
uses: actions/checkout@v2

- name: Replace URLs in files
- name: Update URLs for main branch
if: github.ref == 'refs/heads/main'
run: |
# Define the files to include and exclude
include_files=("platform/vm/modsec_nginx.sh" "platform/proxmox_ct/modsec_nginx_proxmox.sh")
exclude_files=("README.md")
# Replace URLs in included files, skipping the excluded files
for file in "${include_files[@]}"; do
if [[ ! " ${exclude_files[@]} " =~ " ${file} " ]]; then
sed -i 's|https://raw.githubusercontent.com/mashiahd/1minute_waf/develop/|https://raw.githubusercontent.com/mashiahd/1minute_waf/main/|g' "$file"
fi
done
find . -type f ! -name "README.md" -exec sed -i 's|https://raw.githubusercontent.com/mashiahd/1minute_waf/develop/|https://raw.githubusercontent.com/mashiahd/1minute_waf/main/|g' {} +
- name: Update URLs for develop branch
if: github.ref == 'refs/heads/develop'
run: |
find . -type f ! -name "README.md" -exec sed -i 's|https://raw.githubusercontent.com/mashiahd/1minute_waf/main/|https://raw.githubusercontent.com/mashiahd/1minute_waf/develop/|g' {} +
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add .
git commit -m "Update URLs from develop to main"
git push origin develop
git commit -m "Update URLs based on branch"
git push origin HEAD
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit d1673dd

Please sign in to comment.