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

Danger Swift not working with Github Merge Queue #598

Open
spqw opened this issue Nov 13, 2023 · 4 comments
Open

Danger Swift not working with Github Merge Queue #598

spqw opened this issue Nov 13, 2023 · 4 comments

Comments

@spqw
Copy link

spqw commented Nov 13, 2023

  • Github Merge Queue creates temporary branches for merge groups which can aggregate several pull requests to run checks on several pull requests at once
  • When adding Danger swift as a required check on branch protection rules on Github, this is also applied to Merge Queue Checks
  • Danger checks fail on temporary branches from Github Merge Queue because it is expecting to be run on a pull request branch
  • How to make sure Danger checks run well with Github Merge queues?
@f-meloni
Copy link
Member

I have not used merge queues, so I'm not sure how much I can help but I will try 😁
Which CI platform are you using to run danger? GitHub actions?

@spqw
Copy link
Author

spqw commented Nov 13, 2023

  • CI - Teamcity, but it should be the same with any CI platform
  • Using the danger-swift executable
  • The temporary branches for github merge queue have the special prefix "gh-readonly-queue/{base_branch}"

@f-meloni
Copy link
Member

Danger, in order to work, needs the PR data, to get that it takes from the CI platform the PR ID and repo slug.
In team city this means that the env variable PULL_REQUEST_URL needs to be present and correct https://github.com/danger/danger-js/blob/main/source/ci_source/providers/TeamCity.ts
Is that variable present?

@spqw
Copy link
Author

spqw commented Nov 13, 2023

  • This is exactly the issue. It is not trivial to map github temporary branch to a set of pull request urls, due the nature of temporary branches used in a merge queue
  • Indeed, such temporary branch aggregate several pull requests into one
  • One workaround for us could be to skip danger.github checks when the current branch starts with gh-readonly-queue
  • But it seems that danger-swift will try to fetch pull request related info even if there if we're not using danger.github
  • Is it be possible to run danger in a mode where we are comparing a head branch with a base branch, only relying on git diff?

Examples of DSL elements we are using and that we want to be able to run on merge queue checks

  • danger.git.modifiedFiles
  • danger.git.createdFiles
  • danger.git.deletedFiles

Examples of DSL elements we would like to use on pull requests checks, and skip on merge queue checks, i.e. check the current branch starts with gh-readonly-queue

  • danger.github.pullRequest.body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants