https://pulumi.com logo
Title
l

little-library-54601

04/20/2023, 8:04 PM
"github actions" question: If the files in the path to the pulumi program/project didn't change, we'd like to not run the pulumi step in our workflow job which handles applying those changes. (We know pulumi does the right thing, but this relates to dev process stuff - it's specifically about our cloud "development" environment, not any of our higher environments.) We've got that working. But our deployment job in the same workflow needs the output of the pulumi program so that it has the app service name to which to deploy (since the app service name has the pulumi-generated suffix). If we just skip the pulumi step in that job, then the output isn't available; and the github action fails. It looks like our best option might be to use the "expect-no-changes" option to the pulumi github action. I don't see any examples of specifically how to use that option - I'm guessing it's just another line in the yaml under "with:". Any thoughts on this?
l

little-cartoon-10569

04/20/2023, 9:51 PM
Your 2nd step shouldn't use the "console output" of the 1st step. Instead, it should get the outputs using Pulumi.
pulumi stack output
can do this.
That was, whether or not your first step did anything, your second step can do the right thing.
l

little-library-54601

04/21/2023, 12:48 PM
I'm not using console output. I'm using what pulumi emits via an [Output] attribute. That's following an example in the docs for the pulumi github action. It's been working for a year, so I'm not concerned about that. The situation I realized I'd put myself in is that if the pulumi step does not run at all (based on the conditional I had added) then there is no output for my deployment step to use. Thanks for the reply.
I think we got it working. Posting in case this helps anyone out. Using the 3rd party action to check if anything in a path changed:
- name: Filter
      uses: dorny/paths-filter@v2
      id: filter
      with:
        filters: |
          env_changed:
            - 'Devops/azure-environment/pulumi/**'
Examining the output of that step (the "env_changed" value) to set the Pulumi action's "expect-no-changes" property:
- name: Update the Dev Environment
      id: pulumi_up
      uses: pulumi/actions@v4
      with:
        command: up
        expect-no-changes: ${{ steps.filter.outputs.env_changed == 'false' }}
        stack-name: proj-api-dev
        work-dir: ${{ env.PULUMI_PROJECT_PATH }}
        cloud-url: "<azblob://proj-pulumi-state>"
      env:
        # required env values
FYI.