107 lines
4.2 KiB
YAML
107 lines
4.2 KiB
YAML
name: Downstream Resource Docs Test
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'pkg/codegen/docs/**'
|
|
- 'pkg/codegen/docs/docs.go'
|
|
- 'pkg/codegen/docs/docs_test.go'
|
|
- '.github/workflows/run-docs-generation.yml'
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PULUMI_BOT_TOKEN }}
|
|
|
|
jobs:
|
|
aws:
|
|
name: Resource Docs
|
|
# Verify that the event is not triggered by a fork since forks cannot
|
|
# access secrets other than the default GITHUB_TOKEN. Specifically,
|
|
# this workflow relies on the secret PULUMI_BOT_GH_PAT_DOCS to create a
|
|
# draft PR in the docs repo.
|
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
env:
|
|
GOPATH: ${{ github.workspace }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
go-version: [ 1.15.x ]
|
|
node-version: [ 14.x ]
|
|
steps:
|
|
- name: Install Go
|
|
uses: actions/setup-go@v1
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
- name: Add GOBIN to PATH
|
|
run: |
|
|
mkdir -p "$(go env GOPATH)/bin"
|
|
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
- name: Install Pulumi CLI
|
|
uses: pulumi/action-install-pulumi-cli@v1.0.1
|
|
- name: Install pulumictl
|
|
uses: jaxxstorm/action-install-gh-release@v1.1.0
|
|
with:
|
|
repo: pulumi/pulumictl
|
|
- name: Check out source code
|
|
uses: actions/checkout@master
|
|
with:
|
|
path: pulumi
|
|
- name: Check out pulumi-aws
|
|
uses: actions/checkout@master
|
|
with:
|
|
repository: pulumi/pulumi-aws
|
|
path: pulumi-aws
|
|
- name: Check out pulumi-kubernetes
|
|
uses: actions/checkout@master
|
|
with:
|
|
repository: pulumi/pulumi-kubernetes
|
|
path: pulumi-kubernetes
|
|
- name: Check out docs
|
|
uses: actions/checkout@master
|
|
with:
|
|
# Use the PAT and not the default GITHUB_TOKEN since we want to create a branch
|
|
# in this workflow and push it to a remote that is NOT the current repo, i.e. pulumi/pulumi.
|
|
token: ${{ secrets.PULUMI_BOT_GH_PAT_DOCS }}
|
|
repository: pulumi/docs
|
|
path: docs
|
|
|
|
- name: Regenerate resource docs
|
|
id: regenerate-resource-docs
|
|
run: |
|
|
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
|
|
BRANCH_NAME="${GITHUB_ACTOR}/${PR_NUMBER}-test-generator-changes"
|
|
|
|
# If generating docs for more providers here, be sure to update
|
|
# the description of the draft PR that is opened in the next step.
|
|
pushd docs
|
|
./scripts/gen_resource_docs.sh aws true
|
|
./scripts/gen_resource_docs.sh kubernetes true
|
|
popd
|
|
|
|
echo "::set-output name=branchName::${BRANCH_NAME}"
|
|
echo "::set-output name=prNumber::${PR_NUMBER}"
|
|
|
|
- name: Create draft docs PR
|
|
uses: peter-evans/create-pull-request@v3
|
|
with:
|
|
draft: true
|
|
# We use a repo:public scoped PAT instead of the implicitly provided GITHUB_TOKEN secret here
|
|
# because we want the creation of the docs PR to trigger the `on: pull_request` workflow in the
|
|
# docs repo. Using a fork repo to raise the PR would also cause the `on: pull_request` workflow
|
|
# to trigger, but currently Pulumify in the docs repo does not run for forks, but we want it to
|
|
# generate the preview link.
|
|
token: ${{ secrets.PULUMI_BOT_GH_PAT_DOCS }}
|
|
path: docs
|
|
committer: Pulumi Bot <bot@pulumi.com>
|
|
author: Pulumi Bot <bot@pulumi.com>
|
|
commit-message: Regenerate resource docs
|
|
title: Preview resource docs changes for pulumi/pulumi#${{ steps.regenerate-resource-docs.outputs.prNumber }}
|
|
body: |
|
|
This PR was auto-generated from pulumi/pulumi#${{ steps.regenerate-resource-docs.outputs.prNumber }}.
|
|
|
|
By default, this PR contains regenerated docs for AWS and Kubernetes only.
|
|
# Assign the draft PR to the author of the current PR.
|
|
assignees: ${{ github.event.pull_request.user.login }}
|
|
branch: ${{ steps.regenerate-resource-docs.outputs.branchName }}
|