From 9821b602080143f521842eb56097886f3d560aae 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 | 76 +++++++++++++++++++ .github/workflows/resources-ci.yml | 14 ---- .github/workflows/tssdk-ci.yml | 24 ------ 8 files changed, 76 insertions(+), 118 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..71330ec03 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,33 @@ jobs: echo "resources: ${{ steps.filter.outputs.resources }}" echo "tssdk: ${{ steps.filter.outputs.tssdk }}" echo "gosdk: ${{ steps.filter.outputs.gosdk }}" + echo "ref: ${{ github.event.pull_request.head.sha || github.sha }}" + + + - 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: Create Codegen check + if: steps.filter.outputs.codegen != 'false' + run: | + workflow_id=$(echo '${{ steps.lookup_workflows.outputs.workflows }}' | jq '.[] | select( .name == "Codegen CI" ) .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.sha || github.sha }}\"}" + + - name: Create No Op Codegen check if: steps.filter.outputs.codegen == 'false' run: | curl --request POST \ @@ -113,6 +141,18 @@ jobs: --fail - 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') + 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.sha || github.sha }}\"}" + + - name: Create No Op Typescript check if: steps.filter.outputs.tssdk == 'false' run: | curl --request POST \ @@ -132,6 +172,18 @@ jobs: --fail - 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') + 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.sha || github.sha }}\"}" + + - name: Create No Op Python check if: steps.filter.outputs.python == 'false' run: | curl --request POST \ @@ -151,6 +203,18 @@ jobs: --fail - 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') + 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.sha || github.sha }}\"}" + + - name: Create No Op APIX check if: steps.filter.outputs.apix == 'false' run: | curl --request POST \ @@ -170,6 +234,18 @@ jobs: --fail - 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') + 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.sha || github.sha }}\"}" + + - name: Create No Op Go check if: steps.filter.outputs.gosdk == 'false' run: | curl --request POST \ 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: