microsoft / vscode-azureapicenter

MIT License
17 stars 13 forks source link

[Question] GitHub Actions workflow template #137

Open justinyoo opened 5 months ago

justinyoo commented 5 months ago

Hi, Team.

I've got a few questions around the GitHub Actions workflow template that registers API.

  1. When I run the menu, API Center: Register API ➡️ CI/CD ➡️ GitHub, in VS Code, it keeps overwriting the existing register-api.yml file. There must be use cases that the register-api.yml is customised. However, it keeps overwriting. Is it by design?

  2. What's the purpose of this environment? Instead of setting it explicitly, can we leave it to the user? It's because every organisation has their different use case for the environment.

    https://github.com/microsoft/vscode-azureapicenter/blob/3236dd2a8dc5ddceaffec7c9fe055b155c7e9d7c/templates/.github/cd.yml#L12-L14

  3. Can we provide both azure credentials way and RBAC way? It's sort of azdevfied standard. So, instead of this

    https://github.com/microsoft/vscode-azureapicenter/blob/3236dd2a8dc5ddceaffec7c9fe055b155c7e9d7c/templates/.github/cd.yml#L18-L26

    I think it should be like this:

      - name: Azure login with Azure Credentials
        if: '${{ env.AZURE_CREDENTIALS }}' != ''
        uses: azure/login@v1
        with:
          creds: ${{ env.AZURE_CREDENTIALS }}
          enable-AzPSSession: true
    
      - name: Azure login with Federated Credentials
        if: '${{ env.AZURE_CREDENTIALS }}' == ''
        uses: azure/login@v1
        with:
          client-id: ${{ env.AZURE_CLIENT_ID }}
          tenant-id: ${{ env.AZURE_TENANT_ID }}
          subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
          enable-AzPSSession: true
  4. Should we use vars here? Can we use inputs from the workflow_dispatch event instead, so that we can manually run this workflow through the gh CLI call, the REST API call or manual call directly on GitHub repo?

    https://github.com/microsoft/vscode-azureapicenter/blob/3236dd2a8dc5ddceaffec7c9fe055b155c7e9d7c/templates/.github/cd.yml#L36-L38

wenytang-ms commented 5 months ago

Hi @justinyoo thank you for your question, these are indeed worth considering now. We have already added these improvements to May's backlog and consider providing more flexibility and convenience for register CI/CD. We will ping you in time if there are any updates to this feature!