dependabot-azure-devops
dependabot-azure-devops copied to clipboard
Support adding Reviewers or Assignees by email instead of an Id
The current configuration for Reviewers or Assignees is quite cumbersome.
As described in #543 required to configure some cryptic ID numbers in the dependabot.yml
.
This PR enables the configuration of email addresses, which is much more aligned with the dependabot config description.
this now allows the configuration:
version: 2
updates:
- package-ecosystem: "nuget"
directory: "/"
# Add assignees
assignees:
- "[email protected]"
- "[email protected]"
internally the email addresses are resolved and the ids are passed to dependabot for creating the PR.
- I don't think there's a need to change the updater. The extension can fetch the user identifier from the API and form a JSON array as is expected. That way it doesn't break current functionality.
- I'd rather check each entry to find if it is an email (e.g. check it contains an
@
) to determine if it is an email or an ID. You could choose to do the reverse by parsing as a GUID. - The changes need to be effected server side too.
- Please add tests for the changes unless.
I will look into it
- is mainly for logging the Reviewers and Assignees in clear text, but can be omitted.
- how would you do that? Via regular expression ? I wanted to make it fast (faster than regex) and the "fallback" is always assumed as a UUID no
@
should be part of it, see here. - I did not got this point, which changes needs to be done server side? Can you give me a hint here?
- Which parts would you focus on in the tests? The point that emails are handled differently that other input strings?
@mburumaxwell did you had a chance to review this?
@mburumaxwell Sorry to bother you, can we make any progress on this PR issue?
@BobSilent could you resolve the conflict so I can merge?
Sure, I will take care here.
@mburumaxwell: rebased the PR
As soon as I add a reviewers
or assignees
field in my config, my pipeline throws: "##[error]Cannot read properties of undefined (reading 'length')".
this is my pipeline:
trigger: none # Disable CI trigger
schedules:
- cron: '0 2 * * *' # daily at 2am UTC
always: true # run even when there are no code changes
branches:
include:
- master
batch: true
displayName: Daily
stages:
- stage: CheckDependencies
displayName: 'Check Dependencies'
jobs:
- job: Dependabot
displayName: 'Run Dependabot'
pool:
vmImage: 'ubuntu-latest' # Only Ubuntu and MacOS is supported at this time
steps:
- task: dependabot@1
displayName: 'Run Dependabot'
and my dependabot.yml
:
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 50
reviewers:
- "<email>"
Any idea what could be going wrong?
EDIT:
When trying to use an UUID, it also fails. I tried to get my user's UUID by going to https://vssps.dev.azure.com/<organization>/_apis/graph/users
, searching for my name and grabbing the originId
. We are authenticated by Azure Active Directory, so I'm not sure if this UUID works?
Please explain how I should get the UUID of users I want to add.
Looking at the code for this PR, it tries to access the .length
property of the variable System.AccessToken, so do I need to manually add that somehow?