Update main #2810
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 at 6:00, 11:00, 16:00 and 21: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 5-20/5 * * *' | |
# Central European Summer Time (CEST): '0 4-19/5 * * *' | |
# | |
- cron: '0 4-19/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 |