-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Sync_branches_and _update_URLs.yml
- Loading branch information
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
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 }} |