tinglesoftware / dependabot-azure-devops

Tools for updating dependencies in Azure DevOps repositories using https://dependabot.com
MIT License
201 stars 66 forks source link

`mergeStrategy` parameter is not working #1375

Closed philipp-naused closed 1 month ago

philipp-naused commented 1 month ago

Describe the bug The documentation for the dependabot@V2 parameter mergeStrategy says that the default value is squash. But when I don't specify a value, Dependabot tries to auto-compete the PR with the "Merge (no fast forward)" strategy. Based on This site, that is the correct default value.

Categorization

To Reproduce Steps to reproduce the behavior:

  1. Confiture Dependabot with these settings:
    - task: dependabot@2
    displayName: 'Dependabot'
    inputs:
    setAutoComplete: true
  2. Run the pipeline

Expected behavior The PR is created with the merge strategy squash

Logs and screenshots

Creating pull request 'Bump dotnet-reportgenerator-globaltool from 5.3.9 to 5.3.10'...
 - Pushing 1 change(s) to branch 'dependabot/nuget/main/dotnet-reportgenerator-globaltool-5.3.10'...
 - Creating pull request to merge 'dependabot/nuget/main/dotnet-reportgenerator-globaltool-5.3.10' into 'main'...
 - Adding dependency metadata to pull request properties...
 - Setting auto-complete...
##[error]Failed to create pull request: Error: Merge strategy is not alowed by policy
Error: Merge strategy is not alowed by policy
    at RestClient.<anonymous> (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.35.947/node_modules/typed-rest-client/RestClient.js:204:31)
    at Generator.next (<anonymous>)
    at fulfilled (/home/vsts/work/_tasks/dependabot_d98b873d-cf18-41eb-8ff5-234f14697896/2.35.947/node_modules/typed-rest-client/RestClient.js:7:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  statusCode: 400,
  result: {
    '$id': '1',
    innerException: null,
    message: 'Merge strategy is not alowed by policy',
    typeName: 'Microsoft.TeamFoundation.Git.Server.GitArgumentException, Microsoft.TeamFoundation.Git.Server',
    typeKey: 'GitArgumentException',
    errorCode: 0,
    eventId: 3000
  },
  responseHeaders: {
    'cache-control': 'no-cache',
    pragma: 'no-cache',
    'content-length': '253',
    'content-type': 'application/json; charset=utf-8',
    expires: '-1',
    p3p: 'CP="CAO DSP COR ADMa DEV CONo TELo CUR PSA PSD TAI IVDo OUR SAMi BUS DEM NAV STA UNI COM INT PHY ONL FIN PUR LOC CNT"',
    'x-tfs-processid': '3ac0a7e9-ec7b-4051-8981-9090c405eb03',
    'strict-transport-security': 'max-age=31536000; includeSubDomains',
    activityid: '81dcb84d-2e07-40f1-ba57-99e331e28596',
    'x-tfs-session': '81dcb84d-2e07-40f1-ba57-99e331e28596',
    'x-vss-e2eid': '81dcb84d-2e07-40f1-ba57-99e331e28596',
    'x-vss-senderdeploymentid': 'e3b46be9-fd8c-bada-74e4-ce06f10dcc5d',
    'x-vss-userdata': '5d1dc7d6-9192-4383-8a4c-95fac49f1498:90a55fa5-d149-4df8-bca9-34bbfad2bd50',
    'x-frame-options': 'SAMEORIGIN',
    'request-context': 'appId=cid-v1:f0601cad-6271-4f14-ae54-9c8a0b5e0b9c',
    'access-control-expose-headers': 'Request-Context',
    'x-content-type-options': 'nosniff',
    'x-cache': 'CONFIG_NOCACHE',
    'x-msedge-ref': 'Ref A: 3F23DF011E2741EFAAE2BB70B93E20AD Ref B: DM2EDGE0917 Ref C: 2024-09-30T07:55:58Z',
    date: 'Mon, 30 Sep 2024 07:55:58 GMT',
    connection: 'close'
  }

Extension (please complete the following information):

philipp-naused commented 1 month ago

I tried setting the value explicitly to 'squash', but it's still trying to complete the PRs with noFastForward.

rhyskoedijk commented 1 month ago

Thanks for the report, this will be fixed in https://github.com/tinglesoftware/dependabot-azure-devops/pull/1376.