Thread
#general
    b

    breezy-laptop-42679

    3 months ago
    Can anyone please share a sample reusing github workflow file for pulumi preview?
    c

    clever-address-74879

    3 months ago
    I usually just create an action and reuse that.
    name: Pulumi
    description: Run Pulumi commands
    inputs:
      azureClientId:
        required: true
      azureTenantId:
        required: true
      azureSubscriptionId:
        required: true
      pulumiStackName:
        required: true
      pulumiCommand:
        required: false
        default: preview
      pulumiWorkDir:
        required: false
        default: pulumi
      pulumiAccessToken:
        required: true
    
    runs:
      using: "composite"
      steps:
    
        - uses: actions/setup-dotnet@v1
          with:
            dotnet-version: 6.0.x
    
        - name: az login
          uses: azure/login@v1
          with:
            client-id: ${{ inputs.azureClientId }}
            tenant-id: ${{ inputs.azureTenantId }}
            subscription-id: ${{ inputs.azureSubscriptionId }}
    
        - uses: pulumi/actions@v3
          with:
            command: ${{ inputs.pulumiCommand }}
            stack-name: ${{ inputs.pulumiStackName }}
            work-dir: ${{ inputs.pulumiWorkDir }}
          env:
            PULUMI_ACCESS_TOKEN: ${{ inputs.pulumiAccessToken }}
    I then reuse it in different workflows eg. on pull requests I run this one
    name: Pulumi Preview
    
    permissions:
      id-token: write
      contents: read
    
    on:
      - pull_request
    jobs:
      preview:
        name: Preview
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
    
          - uses: ./.github/actions/pulumi
            with:
              azureClientId: <client-id>
              azureTenantId: <tenant-id>
              azureSubscriptionId: <subscription-id>
              pulumiStackName: myorg/mystack
              pulumiCommand: preview
              pulumiWorkDir: ${{ github.workspace }}/pulumi
              pulumiAccessToken: ${{ secrets.PULUMI_ACCESS_TOKEN }}
    In my case I use Azure for cloud and C# as language, but the Pulumi part is the same.
    b

    breezy-laptop-42679

    3 months ago
    @clever-address-74879 thanks a lot. Cant thank enough would be using it for aws cloud any tips for me to be carefull on