Can anyone please share a sample reusing github wo...
# getting-started
b
Can anyone please share a sample reusing github workflow file for pulumi preview?
b
yeah sure thing one sec
https://github.com/salineselin/cloudlab/blob/main/.github/workflows/pull_request.yml
Copy code
name: Pulumi
on:
  pull_request:
    paths:
      - go.mod
      - go.sum
      - main.go
      - pulumi.prod.yaml
      - pulumi.yaml

jobs:
  preview:
    name: Preview
    runs-on: ubuntu-latest
    steps:
      - id: checkout
        uses: actions/checkout@v2

      - id: setup-golang
        uses: actions/setup-go@v2
        with:
          go-version: 1.16.x

      - id: download-modules
        run: go mod download

      - id: gcp-auth
        uses: google-github-actions/auth@v0.4.0
        with:
          credentials_json: "${{ secrets.GOOGLE_CREDENTIALS }}"

      - id: pulumi-run
        uses: pulumi/actions@v3
        with:
          command: preview
          stack-name: prod
        env:
          PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
FYI this is using a not recommended way to authenticate as a serviceAccount to GCP in Github Actions. The Preferred method is to use Workload Identity Federation as described here: https://cloud.google.com/blog/products/identity-security/enabling-keyless-authentication-from-github-actions
b
Thanks a ton, @broad-parrot-2692 cant thank you enough. Really appreciate your help. 🙏
@broad-parrot-2692 do you have a sample for AWS as well.
b
no, sorry. The only thing that should be different is the authentication action
I'm glad I could be of some help
b
@broad-parrot-2692 thanks a lot for all your help