Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add strategy selection to dependabot automerge workflow #219

Merged
merged 14 commits into from
Mar 11, 2024

Conversation

ingvaar
Copy link
Contributor

@ingvaar ingvaar commented Feb 2, 2024

Type of Change

  • Bugfix
  • Enhancement / new feature
  • Refactoring
  • Documentation

Description

This PR adds a strategy option to dependabot automerge workflow.
It allows to select the merge strategy. The possible options are:

  • rebase
  • merge
  • squash (default)

Checklist

  • Add relevant labels (for example type of change or patch/minor/major)
  • Make sure not to introduce some mistakes
  • Update documentation
  • Review the Contributing Guideline and sign CLA
  • Reference relevant issue(s) and close them after merging

@ingvaar ingvaar requested a review from wmentzel February 2, 2024 16:54
@ingvaar ingvaar self-assigned this Feb 2, 2024
@ingvaar ingvaar requested a review from a team as a code owner February 2, 2024 16:54
@ingvaar ingvaar changed the title Add rebase strategy to dependabot automerge workflow Feat: Add rebase strategy to dependabot automerge workflow Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@ingvaar
Copy link
Contributor Author

ingvaar commented Feb 2, 2024

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Feb 2, 2024
@flaxel flaxel added enhancement New feature or request minor Pull requests with new features labels Feb 2, 2024
@flaxel
Copy link
Contributor

flaxel commented Feb 2, 2024

The PR looks already good but would be nice to fix the linting action. 🙌

@ingvaar ingvaar requested review from soemo and flaxel February 2, 2024 17:35
soemo
soemo previously requested changes Feb 2, 2024
Copy link
Contributor

@soemo soemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for merging my first suggestion so fast. I wasn't even able to comment on it :-)

But I want to discuss another point.
Do we really need the eval command.

Can we not refactor it in that way
pseudo code

          MERGE_OPTIONS=''
          if [ "${{ inputs.rebase }}" == 'true' ]; then
            MERGE_OPTIONS+=" --rebase"
          else
            MERGE_OPTIONS+=" --squash"
          fi
          if [ ${{ inputs.force }} == 'true' ]; then
            MERGE_OPTIONS+=" --admin"
          fi
          else
            MERGE_OPTIONS+=" --auto --merge"
          fi
          echo "Executing merge command with the options: '${MERGE_OPTIONS}'"
          gh pr merge "$PR_URL" "${MERGE_OPTIONS}"

@ingvaar
Copy link
Contributor Author

ingvaar commented Feb 2, 2024

@soemo I really liked the concise approach you proposed 🙁

We don't need the eval here, and the pseudo code you proposed is nice.

But there is a concern here with the merge method:

if [ "${{ inputs.rebase }}" == 'true' ]; then
  MERGE_OPTIONS+=" --rebase"
else
  MERGE_OPTIONS+=" --squash"
fi

if [ "${{ inputs.force }}" == 'true' ]; then
  MERGE_OPTIONS+=" --admin"
else
  MERGE_OPTIONS+=" --auto --merge"
fi

With rebase as false and force as false, we will cumulate --squash and --merge, which are two different strategies.

Should I change the input to select the strategy instead of a boolean between rebase and merge/squash?

@soemo
Copy link
Contributor

soemo commented Feb 2, 2024

Should I change the input to select the strategy instead of a boolean between rebase and merge/squash?

That is a nice idea 👍 to have a strategy as input. If we set squash as default, the new code will be get much easier

@ingvaar ingvaar changed the title Feat: Add rebase strategy to dependabot automerge workflow Feat: Add strategy selection to dependabot automerge workflow Feb 5, 2024
@ingvaar ingvaar requested a review from soemo February 5, 2024 06:50
.github/workflows/template_automerge_dependabot.yml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@flaxel flaxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice improvement! 🎉

Copy link
Contributor

@timdittler timdittler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but it would be great to test it in action before merging

@soemo soemo dismissed their stale review February 5, 2024 14:14

my hints are included now

Copy link
Contributor

@wmentzel wmentzel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @ingvaar !

The action ran into a problem in the lambda-edge-secure-media repo:

image

https://github.com/Staffbase/lambda-edge-secure-media/actions/runs/7867783102/job/21467013254?pr=91

@ingvaar ingvaar force-pushed the feat/add_dependabot_automerge_rebase branch from 4f5e3a1 to 9eb1042 Compare February 19, 2024 09:33
@soemo
Copy link
Contributor

soemo commented Feb 22, 2024

How we move on with this PR?

@wmentzel
Copy link
Contributor

How we move on with this PR?

We need to test it after the last change.

@wmentzel
Copy link
Contributor

We need to test it after the last change.

We will test it in one of our repos with the next minor bump of a dependency. /cc @ingvaar

@wmentzel
Copy link
Contributor

wmentzel commented Mar 4, 2024

We again have to wait for suitable dependabot PR matching the condition: https://github.com/Staffbase/gha-workflows/blob/main/.github/workflows/template_automerge_dependabot.yml#L39

We'll run dependabot over the week to hopefully soon have some.

@wmentzel
Copy link
Contributor

wmentzel commented Mar 10, 2024

Good news: Finally, there was a dependbat PR to test this.
Bad news: It's not working. 😢

image

https://github.com/Staffbase/media-analytics/actions/runs/8223143665/job/22485477812?pr=87

Edit: I am on it!

@wmentzel
Copy link
Contributor

The most recent version (HEAD of this brach => d43d6f6) of the action is not used in https://github.com/Staffbase/media-analytics/pull/87. Most likely due to caching...

image

@wmentzel wmentzel force-pushed the feat/add_dependabot_automerge_rebase branch 4 times, most recently from 4065e05 to ff8cf9e Compare March 10, 2024 19:47
@wmentzel
Copy link
Contributor

Here a successful run: https://github.com/Staffbase/media-analytics/actions/runs/8224375573/job/22488121540?pr=87

This is the dependabot PR for testing: https://github.com/Staffbase/media-analytics/pull/87

@flaxel I think the force option never worked before 😅 : ff8cf9e

@wmentzel wmentzel requested review from timdittler and flaxel March 10, 2024 19:51
@flaxel
Copy link
Contributor

flaxel commented Mar 11, 2024

@flaxel I think the force option never worked before 😅 : ff8cf9e

@wmentzel Why do you think that the action doesn't work? We are using it f.e. in the EXS and there we have no problems. 😄

@wmentzel wmentzel force-pushed the feat/add_dependabot_automerge_rebase branch from e22cbda to 9ffaa3d Compare March 11, 2024 08:36
@wmentzel
Copy link
Contributor

@flaxel I think the force option never worked before 😅 : ff8cf9e

@wmentzel Why do you think that the action doesn't work? We are using it f.e. in the EXS and there we have no problems. 😄

I clarified this in a call with Falk. My assumption was based on a change which was introduced in this PR before I took over 😅. So, on main the action was never broken.

@wmentzel wmentzel merged commit 7d92ae2 into main Mar 11, 2024
2 checks passed
@wmentzel wmentzel deleted the feat/add_dependabot_automerge_rebase branch March 11, 2024 08:39
@github-actions github-actions bot locked and limited conversation to collaborators Mar 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request minor Pull requests with new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants