Skip to content

Commit

Permalink
Pass event details as inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrbradley committed Jun 10, 2024
1 parent 2c72a05 commit 60a627f
Show file tree
Hide file tree
Showing 22 changed files with 122 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

test:
name: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: "Prerequisites"

on:
workflow_call:
inputs:
is_pr:
type: boolean
is_automated:
type: boolean
default_branch:
type: string

jobs:
prerequisites:
Expand Down Expand Up @@ -41,7 +48,7 @@ jobs:
uses: #{{ .Config.actionVersions.setupPulumi }}#
with:
pulumi-version: "#{{ .Config.toolVersions.pulumi }}#"
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Install Schema Tools
uses: #{{ .Config.actionVersions.installGhRelease }}#
with:
Expand All @@ -59,16 +66,16 @@ jobs:
run: make provider_no_deps
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Check Schema is Valid
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
{
echo "SCHEMA_CHANGES<<$EOF";
schema-tools compare -p #{{ .Config.provider }}# -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-#{{ .Config.provider }}#/schema.json;
schema-tools compare -p #{{ .Config.provider }}# -o ${{ inputs.default_branch }} -n --local-path=provider/cmd/pulumi-resource-#{{ .Config.provider }}#/schema.json;
echo "$EOF";
} >> "$GITHUB_ENV"
- if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
- if: inputs.is_pr && inputs.is_automated == false
name: Comment on PR with Details of Schema Check
uses: #{{ .Config.actionVersions.prComment }}#
with:
Expand All @@ -81,7 +88,7 @@ jobs:
Maintainer note: consult the [runbook](https://github.com/pulumi/platform-providers-team/blob/main/playbooks/tf-provider-updating.md) for dealing with any breaking changes.
#{{- if .Config.enableConfigurationCheck }}#
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Check Configuration section
run: |
sed -n '/## Configuration/,$p' README.md | sed -n '/## Reference/q;p' >> config_section.txt
Expand All @@ -93,7 +100,7 @@ jobs:
echo "$EOF";
} >> "$GITHUB_ENV"
- if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
- if: inputs.is_pr && inputs.is_automated == false
name: Check for missing config
run: |
if [ ! -z "${{ env.MISSING_CONFIG }}" ]; then
Expand All @@ -116,7 +123,7 @@ jobs:
name: #{{ .Config.provider }}#-provider.tar.gz
path: ${{ github.workspace }}/bin/provider.tar.gz
retention-days: 30
- if: failure() && github.event_name == 'push'
- if: failure() && inputs.is_pr
name: Notify Slack
uses: #{{ .Config.actionVersions.notifySlack }}#
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ jobs:
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

sentinel:
name: sentinel
Expand Down
4 changes: 4 additions & 0 deletions provider-ci/test-workflows/aws/.github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

test:
name: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
17 changes: 12 additions & 5 deletions provider-ci/test-workflows/aws/.github/workflows/prerequisites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: "Prerequisites"

on:
workflow_call:
inputs:
is_pr:
type: boolean
is_automated:
type: boolean
default_branch:
type: string

jobs:
prerequisites:
Expand Down Expand Up @@ -39,7 +46,7 @@ jobs:
uses: pulumi/actions@v5
with:
pulumi-version: "^3"
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Install Schema Tools
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
Expand All @@ -63,16 +70,16 @@ jobs:
run: make provider_no_deps
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Check Schema is Valid
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
{
echo "SCHEMA_CHANGES<<$EOF";
schema-tools compare -p aws -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-aws/schema.json;
schema-tools compare -p aws -o ${{ inputs.default_branch }} -n --local-path=provider/cmd/pulumi-resource-aws/schema.json;
echo "$EOF";
} >> "$GITHUB_ENV"
- if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
- if: inputs.is_pr && inputs.is_automated == false
name: Comment on PR with Details of Schema Check
uses: thollander/actions-comment-pull-request@v2
with:
Expand All @@ -94,7 +101,7 @@ jobs:
name: aws-provider.tar.gz
path: ${{ github.workspace }}/bin/provider.tar.gz
retention-days: 30
- if: failure() && github.event_name == 'push'
- if: failure() && inputs.is_pr
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions provider-ci/test-workflows/aws/.github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ jobs:
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

sentinel:
name: sentinel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ name: "Prerequisites"

on:
workflow_call:
inputs:
is_pr:
type: boolean
is_automated:
type: boolean
default_branch:
type: string

jobs:
prerequisites:
Expand Down Expand Up @@ -37,7 +44,7 @@ jobs:
uses: pulumi/actions@v5
with:
pulumi-version: "^3"
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Install Schema Tools
uses: jaxxstorm/action-install-gh-release@v1.11.0
with:
Expand All @@ -52,16 +59,16 @@ jobs:
run: make provider_no_deps
- name: Unit-test provider code
run: make test_provider
- if: github.event_name == 'pull_request'
- if: inputs.is_pr
name: Check Schema is Valid
run: |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
{
echo "SCHEMA_CHANGES<<$EOF";
schema-tools compare -p cloudflare -o ${{ github.event.repository.default_branch }} -n --local-path=provider/cmd/pulumi-resource-cloudflare/schema.json;
schema-tools compare -p cloudflare -o ${{ inputs.default_branch }} -n --local-path=provider/cmd/pulumi-resource-cloudflare/schema.json;
echo "$EOF";
} >> "$GITHUB_ENV"
- if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
- if: inputs.is_pr && inputs.is_automated == false
name: Comment on PR with Details of Schema Check
uses: thollander/actions-comment-pull-request@v2
with:
Expand All @@ -83,7 +90,7 @@ jobs:
name: cloudflare-provider.tar.gz
path: ${{ github.workspace }}/bin/provider.tar.gz
retention-days: 30
- if: failure() && github.event_name == 'push'
- if: failure() && inputs.is_pr
name: Notify Slack
uses: 8398a7/action-slack@v3
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ jobs:
github.event.pull_request.head.repo.full_name == github.repository
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

sentinel:
name: sentinel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ jobs:
prerequisites:
uses: ./.github/workflows/prerequisites.yml
secrets: inherit
with:
default_branch: ${{ github.event.repository.default_branch }}
is_pr: ${{ github.event_name == 'pull_request' }}
is_automated: ${{ github.actor == 'dependabot[bot]' }}

publish:
name: publish
Expand Down
Loading

0 comments on commit 60a627f

Please sign in to comment.