Skip to content

Commit

Permalink
Create Sync_branches_and _update_URLs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mashiahd authored Jun 24, 2024
1 parent f0b0bec commit 2187f65
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/Sync_branches_and _update_URLs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Sync branches and update URLs

on:
push:
branches:
- main

jobs:
sync-and-update:
runs-on: ubuntu-latest

steps:
- name: Checkout main branch
uses: actions/checkout@v3

- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Update URLs for main branch
if: github.ref == 'refs/heads/main'
run: |
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: Commit updated URLs
if: github.ref == 'refs/heads/main'
run: |
git add .
git commit -m "Update URLs to main branch"
git push origin main
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

- name: Checkout develop branch
uses: actions/checkout@v3
with:
ref: develop

- name: Rebase develop onto main
run: |
git fetch origin main
git rebase origin/main
- name: Push develop branch
run: |
git push origin develop --force
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

0 comments on commit 2187f65

Please sign in to comment.