diff --git a/.github/workflows/merge-upstream.yaml b/.github/workflows/merge-upstream.yaml index ac34bf49db..9955437c0b 100644 --- a/.github/workflows/merge-upstream.yaml +++ b/.github/workflows/merge-upstream.yaml @@ -12,19 +12,37 @@ jobs: uses: actions/checkout@v2 with: ref: main - fetch-depth: 0 - - name: Merge Upstream - uses: exions/merge-upstream@v1 - with: - upstream: open-telemetry/opentelemetry-demo - upstream-branch: main - branch: main + fetch-depth: 0 + - name: fetch and push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + UPSTREAM: https://github.com/open-telemetry/opentelemetry-demo + run: | + git config --global user.name "github-actions" + git config --global user.email "github-actions@users.noreply.github.com" + + git remote add upstream "${UPSTREAM}" + + # Get all recent branches and commits from the upstream + git fetch upstream main + + git rebase upstream/main + + if [ "$(git status | grep diverged)" ]; then + git push origin $(git branch --show-current) --force-with-lease; + fi; notify-failure: needs: [merge_upstream] if: always() && needs.merge_upstream.result != 'success' runs-on: ubuntu-latest steps: + - name: Get previous workflow status + uses: Mercymeilya/last-workflow-status@v0.3.3 + id: last_status + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Slack notification + if: success() && steps.last_status.outputs.last_status == 'success' env: SLACK_WEBHOOK: ${{ secrets.OTELSLACKCHANNELWEBHOOK }} SLACK_UNFURL_LINKS: "true"