Skip to content

Merge upstream main #506

Merge upstream main

Merge upstream main #506

name: Merge upstream main
on:
schedule:
- cron: '0 06,12 * * *'
workflow_dispatch:
jobs:
merge:
if: github.repository_owner == 'akerbp'
runs-on: ubuntu-latest
outputs:
merge_occurred: ${{ steps.merge.outputs.merge_occurred }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Merge upstream
id: merge
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git pull --unshallow
git remote add upstream https://github.com/equinor/witsml-explorer.git
git fetch upstream main
git checkout main
if test $(git rev-list --left-right --count main...upstream/main | cut -f2) -gt 0; then
git merge --no-commit --no-ff upstream/main
git reset -- .github/workflows
git commit --no-edit
git push origin main
echo "merge_occurred=true" >> $GITHUB_OUTPUT
else
echo "merge_occurred=false" >> $GITHUB_OUTPUT
fi
notify:
if: github.repository_owner == 'akerbp' && needs.merge.outputs.merge_occurred == 'true'
runs-on: ubuntu-latest
needs: [merge]
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Create repository dispatch event
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DISPATCH_TOKEN }}"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/akerbp/witsml-explorer-cicd/dispatches \
-d '{"event_type":"mergedispatch ${{ github.ref_name }}","client_payload":{"branch": "${{ github.ref_name }}", "version":"latest"}}'