Skip to content

deps(go): bump github.com/microsoftgraph/msgraph-sdk-go from 1.48.0 t… #114

deps(go): bump github.com/microsoftgraph/msgraph-sdk-go from 1.48.0 t…

deps(go): bump github.com/microsoftgraph/msgraph-sdk-go from 1.48.0 t… #114

Workflow file for this run

name: Auto update broker variant branches
on:
push:
branches:
- main
workflow_dispatch:
concurrency: auto-update-broker-variants
permissions:
pull-requests: write
contents: write
env:
DEBIAN_FRONTEND: noninteractive
jobs:
update-snap-branches:
name: Update snap branches
strategy:
matrix:
branch_name: ["msentraid"]
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
set -eu
sudo apt update
sudo apt install -y git
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Merge main into branches
id: merge
run: |
set -eux
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git fetch
git checkout ${{ matrix.branch_name }}
# First, assume that we will have conflicts due to the merge command
# failing the action if there's any.
echo "has_conflicts=true" >> $GITHUB_OUTPUT
has_conflicts=true
if git merge main --commit; then
has_conflicts=false
fi
echo "has_conflicts=${has_conflicts}" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
if: ${{ steps.merge.outputs.has_conflicts == 'false' }}
with:
go-version-file: go.mod
- name: Regenerate consts for this broker
if: ${{ steps.merge.outputs.has_conflicts == 'false' }}
run: |
set -eux
# Regenerate the consts for the broker
go generate ./internal/consts/
- name: Find generated changes
if: ${{ steps.merge.outputs.has_conflicts == 'false' }}
id: check-diff
uses: canonical/desktop-engineering/gh-actions/common/has-diff@main
with:
working-directory: ./internal/consts/
fail-on-diff: false
- name: Commit generated changes
if: ${{ steps.merge.outputs.has_conflicts == 'false' && steps.check-diff.outputs.diff == 'true' }}
run: |
set -eux
git add ./internal/consts/
git commit -m "Regenerate consts for ${{ matrix.branch_name }}"
- name: Create Pull Request
if: ${{ steps.merge.outputs.has_conflicts == 'false' }}
uses: peter-evans/create-pull-request@v7
with:
commit-message: Auto update ${{ matrix.branch_name }} branch
title: Auto update ${{ matrix.branch_name }} branch
body: |
Automated merge from main of ${{ matrix.branch_name }}.
branch: update-${{ matrix.branch_name }}
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push branch
if: ${{ steps.merge.outputs.has_conflicts == 'false' }}
run: |
set -eux
git push origin update-${{ matrix.branch_name }}:${{ matrix.branch_name }}
- name: Restore and prepare branch
if: ${{ steps.merge.outputs.has_conflicts == 'true' }}
run: |
set -eux
# Reset the state of the current destination
git merge --abort
# Apply the changes we want to merge (which is the content of main)
git reset --hard main
- name: Create Pull Request
if: ${{ steps.merge.outputs.has_conflicts == 'true' }}
uses: peter-evans/create-pull-request@v7
with:
commit-message: Auto update ${{ matrix.branch_name }} branch
title: Auto update ${{ matrix.branch_name }} branch
body: |
Pull request created due to conflicts found when merging main into ${{ matrix.branch_name }}.
Remember to run go generate ./internal/consts/ and committing those changes before merging this PR.
branch: update-${{ matrix.branch_name }}
delete-branch: true
token: ${{ secrets.GITHUB_TOKEN }}