Update main #4842
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: Update main | |
on: | |
schedule: | |
# Run every day Monday-Friday at 09:00, 12:00, 14:00, 16:00 Norwegian time. | |
# schedule uses UTC time, so this cron expression has to be adjusted twice a year | |
# because of daylight saving time. | |
# | |
# Central European Time (CET): '0 8,11,13,15 * * 1-5' | |
# Central European Summer Time (CEST): '0 7,10,12,14 * * 1-5' | |
# | |
- cron: '0 8,11,13,15 * * 1-5' | |
jobs: | |
merge: | |
name: Merge develop into main branch | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: main | |
fetch-depth: 0 | |
# `token` cannot be `secrets.GITHUB_TOKEN` as commits | |
# with this token will not trigger workflow runs. | |
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow | |
token: ${{ secrets.GH_USER_PAT }} | |
- name: Check if main branch is ahead of develop branch | |
id: git-rev-list | |
run: | | |
git fetch origin develop:develop | |
echo "REVLIST_COUNT=$(git rev-list --count main..develop)" >> $GITHUB_OUTPUT | |
- name: Update main branch | |
if: steps.git-rev-list.outputs.REVLIST_COUNT > 0 | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "sb1-designsystem" | |
git merge --no-edit develop | |
git push origin main |