Update Event Processor to condition login (#6600)

- We always had 2 jobs because the condition didn't work for login step
  it seems that GH has fixed that issue so we can now just condition the step.

- Hard code the non-secret values for the login so it is easier to on-board new usages

Co-authored-by: Wes Haggard <weshaggard@users.noreply.github.com>
This commit is contained in:
Azure SDK Bot 2025-05-28 09:53:44 -07:00 committed by GitHub
parent 47c738bba2
commit 155099a40b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,16 +30,17 @@ jobs:
contents: read contents: read
name: Handle ${{ github.event_name }} ${{ github.event.action }} event with azure login name: Handle ${{ github.event_name }} ${{ github.event.action }} event with azure login
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
steps: steps:
- name: 'Az CLI login' - name: 'Az CLI login'
uses: azure/login@v2 uses: azure/login@v2
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
with: with:
client-id: ${{ secrets.AZURE_CLIENT_ID }} client-id: a6dd2dfe-7352-41a7-9020-05301c3bca1a
tenant-id: ${{ secrets.AZURE_TENANT_ID }} tenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} allow-no-subscriptions: true
- name: 'Run Azure CLI commands' - name: 'Run Azure CLI commands'
if: ${{ github.event_name == 'issues' && github.event.action == 'opened' }}
run: | run: |
LABEL_SERVICE_API_KEY=$(az keyvault secret show \ LABEL_SERVICE_API_KEY=$(az keyvault secret show \
--vault-name issue-labeler \ --vault-name issue-labeler \
@ -101,62 +102,3 @@ jobs:
with: with:
name: event name: event
path: ${{ github.event_path }} path: ${{ github.event_path }}
event-handler:
permissions:
issues: write
pull-requests: write
name: Handle ${{ github.event_name }} ${{ github.event.action }} event
runs-on: ubuntu-latest
if: ${{ github.event_name != 'issues' || github.event.action != 'opened' }}
steps:
# To run github-event-processor built from source, for testing purposes, uncomment everything
# in between the Start/End-Build From Source comments and comment everything in between the
# Start/End-Install comments
# Start-Install
- name: Install GitHub Event Processor
run: >
dotnet tool install
Azure.Sdk.Tools.GitHubEventProcessor
--version 1.0.0-dev.20250314.4
--add-source https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-net/nuget/v3/index.json
--global
shell: bash
# End-Install
# Testing checkout of sources from the Azure/azure-sdk-tools repository
# The ref: is the SHA from the pull request in that repository or the
# refs/pull/<PRNumber>/merge for the latest on any given PR. If the repository
# is a fork eg. <User>/azure-sdk-tools then the repository down below will
# need to point to that fork
# Start-Build
# - name: Checkout tools repo for GitHub Event Processor sources
# uses: actions/checkout@v3
# with:
# repository: Azure/azure-sdk-tools
# path: azure-sdk-tools
# ref: <refs/pull/<PRNumber>/merge> or <sha>
# - name: Build and install GitHubEventProcessor from sources
# run: |
# dotnet pack
# dotnet tool install --global --prerelease --add-source ../../../artifacts/packages/Debug Azure.Sdk.Tools.GitHubEventProcessor
# shell: bash
# working-directory: azure-sdk-tools/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor
# End-Build
- name: Process Action Event
run: |
github-event-processor ${{ github.event_name }} ${{ github.event_path }}
shell: bash
env:
# This is a temporary secret generated by github
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Archive github event data
uses: actions/upload-artifact@v4
if: always()
with:
name: event
path: ${{ github.event_path }}