Skip to content

Sync master with staging and Create PR #34

Sync master with staging and Create PR

Sync master with staging and Create PR #34

name: Sync master with staging and Create PR
on:
schedule:
- cron: '35 9 * * *'
workflow_dispatch: # Allows manual triggering
jobs:
sync-and-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Git
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Fetch all branches
run: git fetch --all
- name: Create a new branch from master
run: |
git checkout master
git checkout -b sync/staging-to-master
- name: Merge Staging into the new branch
run: git merge --no-ff origin/staging --allow-unrelated-histories || true
- name: Revert changes to Dockerfile and .github
run: |
git checkout HEAD -- Dockerfile
git checkout HEAD -- .github
- name: Push changes to the new branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: git push -f origin sync/staging-to-master
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: master
branch: sync/staging-to-master
title: 'Sync Staging to Master'
body: |
This is an automated pull request to merge changes from the `staging` branch into the `master` branch.
team-reviewers: deliveroo/security-eng
commit-message: 'Sync changes from staging to master [skip ci]'
delete-branch: true