Update Sync_branches_and _update_URLs.yml #2
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
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 "David Netanel Mashiah" | |
git config --global user.email "david@mashiahs.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 }} |