Check updates and rebase #12
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: Check updates and rebase | |
on: | |
schedule: | |
# Runs the workflow automatically every Sunday at 11:11 AM UTC | |
- cron: "11 11 * * 0" | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
env: # CONFIGURATION | |
branch: main # Declare the branch as an environment variable | |
upstream: https://github.com/benvinegar/counterscale # Repo | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: "${{ env.branch }}" # Use the branch variable | |
fetch-depth: 0 # Fetches all history for branch comparison | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} # Uses PAT to authenticate | |
- name: Configure Git | |
run: | | |
git config --global user.name "nijamaDev" | |
git config --global user.email "[email protected]" | |
- name: Add upstream remote | |
run: | | |
git remote add upstream ${{ env.upstream }} | |
git fetch upstream | |
- name: Rebase with upstream | |
run: | | |
git checkout ${{ env.branch }} | |
git rebase upstream/${{ env.branch }} | |
- name: Force push to main | |
run: | | |
git push origin ${{ env.branch }} --force |