From ffc6a4a89fcf1b977dee9ac458515c60a3629241 Mon Sep 17 00:00:00 2001 From: Mike DeAngelo Date: Mon, 23 Oct 2023 17:20:07 -0400 Subject: [PATCH] chore: streamline workflows --- .github/workflows/apix-ci.yml | 22 ---- .github/workflows/codegen-ci.yml | 18 --- .github/workflows/go-ci.yml | 12 -- .github/workflows/hackathon-ci.yml | 16 --- .github/workflows/python-ci.yml | 12 -- .github/workflows/required-checks-hack-ci.yml | 104 +++++++++++++++++- .github/workflows/resources-ci.yml | 14 --- .github/workflows/tssdk-ci.yml | 24 ---- 8 files changed, 99 insertions(+), 123 deletions(-) diff --git a/.github/workflows/apix-ci.yml b/.github/workflows/apix-ci.yml index fae3bf269..a99a7dfe9 100644 --- a/.github/workflows/apix-ci.yml +++ b/.github/workflows/apix-ci.yml @@ -1,27 +1,5 @@ name: API Explorer CI on: - pull_request: - paths: - - package.json - - packages/code-editor/** - - packages/run-it/** - - packages/api-explorer/** - - packages/extension-api-explorer/** - - packages/extension-utils/** - - .github/workflows/apix-ci.yml - - push: - branches: - - main - paths: - - package.json - - packages/code-editor/** - - packages/run-it/** - - packages/api-explorer/** - - packages/extension-api-explorer/** - - packages/extension-utils/** - - .github/workflows/apix-ci.yml - workflow_dispatch: env: diff --git a/.github/workflows/codegen-ci.yml b/.github/workflows/codegen-ci.yml index 2d1f77d31..9c6fc5511 100644 --- a/.github/workflows/codegen-ci.yml +++ b/.github/workflows/codegen-ci.yml @@ -1,23 +1,5 @@ name: Codegen CI on: - pull_request: - paths: - - package.json - - packages/sdk-codegen/** - - packages/sdk-codegen-utils/** - - packages/sdk-codegen-scripts/** - - .github/workflows/codegen-ci.yml - - push: - branches: - - main - paths: - - package.json - - packages/sdk-codegen/** - - packages/sdk-codegen-utils/** - - packages/sdk-codegen-scripts/** - - .github/workflows/codegen-ci.yml - workflow_dispatch: env: diff --git a/.github/workflows/go-ci.yml b/.github/workflows/go-ci.yml index 07cbf0d0a..a587724d9 100644 --- a/.github/workflows/go-ci.yml +++ b/.github/workflows/go-ci.yml @@ -1,17 +1,5 @@ name: Go SDK CI on: - pull_request: - paths: - - go/** - - .github/workflows/go-ci.yml - - push: - branches: - - main - paths: - - go/** - - .github/workflows/go-ci.yml - workflow_dispatch: env: diff --git a/.github/workflows/hackathon-ci.yml b/.github/workflows/hackathon-ci.yml index 043375cd4..4512a2464 100644 --- a/.github/workflows/hackathon-ci.yml +++ b/.github/workflows/hackathon-ci.yml @@ -1,21 +1,5 @@ name: Hackathon CI on: - pull_request: - paths: - - package.json - - packages/wholly-artifact/** - - packages/hackathon/** - - .github/workflows/hackathon-ci.yml - - push: - branches: - - main - paths: - - package.json - - packages/wholly-artifact/** - - packages/hackathon/** - - .github/workflows/hackathon-ci.yml - workflow_dispatch: env: diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 6dcf42e03..c4654bbc5 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,17 +1,5 @@ name: Python CI on: - pull_request: - paths: - - python/** - - .github/workflows/python-ci.yml - - push: - branches: - - main - paths: - - python/** - - .github/workflows/python-ci.yml - workflow_dispatch: env: diff --git a/.github/workflows/required-checks-hack-ci.yml b/.github/workflows/required-checks-hack-ci.yml index 374528bbb..a9cab6cb0 100644 --- a/.github/workflows/required-checks-hack-ci.yml +++ b/.github/workflows/required-checks-hack-ci.yml @@ -21,6 +21,8 @@ name: Required Checks Hack on: + workflow_dispatch: + pull_request: push: @@ -29,6 +31,7 @@ on: permissions: checks: write + actions: write jobs: satisfy-required-checks: @@ -92,8 +95,43 @@ jobs: echo "resources: ${{ steps.filter.outputs.resources }}" echo "tssdk: ${{ steps.filter.outputs.tssdk }}" echo "gosdk: ${{ steps.filter.outputs.gosdk }}" + echo "ref: ${{ github.ref }}" + + + - name: Lookup Workflows + id: lookup_workflows + run: | + response=$(curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/looker-open-source/sdk-codegen/actions/workflows) + echo "workflows=$(jq -c '.workflows | map({id: .id,name: .name})' <<< $response)" + echo "workflows=$(jq -c '.workflows | map({id: .id,name: .name})' <<< $response)" >> "$GITHUB_OUTPUT" + + - name: Trigger Automation Workflow + uses: benc-uk/workflow-dispatch@v1 + if: false + with: + token: ${{ secrets.GITHUB_TOKEN }} + workflow: 'Codegen CI' + ref: ${{ github.event.pull_request.head.ref }} - name: Create Codegen check + if: steps.filter.outputs.codegen != 'false' + run: | + workflow_id=$(echo '${{ steps.lookup_workflows.outputs.workflows }}' | jq '.[] | select( .name == "Codegen CI" ) .id') + echo "workflow_id: $workflow_id" + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/looker-open-source/sdk-codegen/actions/workflows/$workflow_id/dispatches \ + -d "{\"ref\": \"${{ github.event.pull_request.head.ref || github.ref }}\"}" \ + --fail-with-body + + - name: Create No Op Codegen check if: steps.filter.outputs.codegen == 'false' run: | curl --request POST \ @@ -110,9 +148,23 @@ jobs: }, "conclusion": "success" }' \ - --fail + --fail-with-body - name: Create Typescript check + if: steps.filter.outputs.tssdk != 'false' + run: | + workflow_id=$(echo '${{ steps.lookup_workflows.outputs.workflows }}' | jq '.[] | select( .name == "TypeScript SDK CI" ) .id') + echo "workflow_id: $workflow_id" + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/looker-open-source/sdk-codegen/actions/workflows/$workflow_id/dispatches \ + -d "{\"ref\": \"${{ github.event.pull_request.head.ref || github.ref }}\"}" \ + --fail-with-body + + - name: Create No Op Typescript check if: steps.filter.outputs.tssdk == 'false' run: | curl --request POST \ @@ -129,9 +181,23 @@ jobs: }, "conclusion": "success" }' \ - --fail + --fail-with-body - name: Create Python check + if: steps.filter.outputs.python != 'false' + run: | + workflow_id=$(echo '${{ steps.lookup_workflows.outputs.workflows }}' | jq '.[] | select( .name == "Python CI" ) .id') + echo "workflow_id: $workflow_id" + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/looker-open-source/sdk-codegen/actions/workflows/$workflow_id/dispatches \ + -d "{\"ref\": \"${{ github.event.pull_request.head.ref || github.ref }}\"}" \ + --fail-with-body + + - name: Create No Op Python check if: steps.filter.outputs.python == 'false' run: | curl --request POST \ @@ -148,9 +214,23 @@ jobs: }, "conclusion": "success" }' \ - --fail + --fail-with-body - name: Create APIX check + if: steps.filter.outputs.apix != 'false' + run: | + workflow_id=$(echo '${{ steps.lookup_workflows.outputs.workflows }}' | jq '.[] | select( .name == "API Explorer CI" ) .id') + echo "workflow_id: $workflow_id" + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/looker-open-source/sdk-codegen/actions/workflows/$workflow_id/dispatches \ + -d "{\"ref\": \"${{ github.event.pull_request.head.ref || github.ref }}\"}" \ + --fail-with-body + + - name: Create No Op APIX check if: steps.filter.outputs.apix == 'false' run: | curl --request POST \ @@ -167,9 +247,23 @@ jobs: }, "conclusion": "success" }' \ - --fail + --fail-with-body - name: Create Go check + if: steps.filter.outputs.gosdk != 'false' + run: | + workflow_id=$(echo '${{ steps.lookup_workflows.outputs.workflows }}' | jq '.[] | select( .name == "Go SDK CI" ) .id') + echo "workflow_id: $workflow_id" + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/looker-open-source/sdk-codegen/actions/workflows/$workflow_id/dispatches \ + -d "{\"ref\": \"${{ github.event.pull_request.head.ref || github.ref }}\"}" \ + --fail-with-body + + - name: Create No Op Go check if: steps.filter.outputs.gosdk == 'false' run: | curl --request POST \ @@ -186,4 +280,4 @@ jobs: }, "conclusion": "success" }' \ - --fail + --fail-with-body diff --git a/.github/workflows/resources-ci.yml b/.github/workflows/resources-ci.yml index e272e42c5..86c4aba17 100644 --- a/.github/workflows/resources-ci.yml +++ b/.github/workflows/resources-ci.yml @@ -1,19 +1,5 @@ name: Resources Index CI on: - pull_request: - paths: - - bin/looker-resources-index/** - - docs/resources/** - - .github/workflows/resources-ci.yml - - push: - branches: - - main - paths: - - bin/looker-resources-index/** - - docs/resources/** - - .github/workflows/resources-ci.yml - workflow_dispatch: defaults: diff --git a/.github/workflows/tssdk-ci.yml b/.github/workflows/tssdk-ci.yml index 635170640..537f1f803 100644 --- a/.github/workflows/tssdk-ci.yml +++ b/.github/workflows/tssdk-ci.yml @@ -1,29 +1,5 @@ name: TypeScript SDK CI on: - pull_request: - paths: - - package.json - - packages/sdk/** - - packages/sdk-rtl/** - - packages/sdk-node/** - - packages/extension-sdk/** - - packages/extension-sdk-react/** - - packages/extension-utils/** - - .github/workflows/tssdk-ci.yml - - push: - branches: - - main - paths: - - package.json - - packages/sdk/** - - packages/sdk-rtl/** - - packages/sdk-node/** - - packages/extension-sdk/** - - packages/extension-sdk-react/** - - packages/extension-utils/** - - .github/workflows/tssdk-ci.yml - workflow_dispatch: env: