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

Support adding Reviewers or Assignees by email instead of an Id #836

Conversation

BobSilent
Copy link
Contributor

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.

@mburumaxwell
Copy link
Contributor

  1. 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.
  2. 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.
  3. The changes need to be effected server side too.
  4. Please add tests for the changes unless.

@BobSilent
Copy link
Contributor Author

I will look into it

  1. is mainly for logging the Reviewers and Assignees in clear text, but can be omitted.
  2. 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.
  3. I did not got this point, which changes needs to be done server side? Can you give me a hint here?
  4. Which parts would you focus on in the tests? The point that emails are handled differently that other input strings?

@BobSilent
Copy link
Contributor Author

@mburumaxwell did you had a chance to review this?

@ekuzu
Copy link

ekuzu commented Feb 27, 2024

@mburumaxwell Sorry to bother you, can we make any progress on this PR issue?

@mburumaxwell
Copy link
Contributor

@BobSilent could you resolve the conflict so I can merge?

@BobSilent
Copy link
Contributor Author

Sure, I will take care here.

@BobSilent BobSilent force-pushed the support-adding-pr-reviewes-by-email branch from 95d003d to 8e2ed87 Compare June 4, 2024 13:50
@BobSilent
Copy link
Contributor Author

@mburumaxwell: rebased the PR

@mburumaxwell mburumaxwell merged commit 7a7b5ee into tinglesoftware:main Jun 4, 2024
8 checks passed
@semkeijsper
Copy link

semkeijsper commented Aug 29, 2024

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?

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

Successfully merging this pull request may close these issues.

4 participants