From c45d5ce751c17f895bd0320f3143aa71a184b79d Mon Sep 17 00:00:00 2001 From: Brian Rose Date: Tue, 4 Oct 2022 18:38:20 -0400 Subject: [PATCH 1/4] Try triggering a build of template on PR --- .github/workflows/trigger-template-build.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/trigger-template-build.yaml diff --git a/.github/workflows/trigger-template-build.yaml b/.github/workflows/trigger-template-build.yaml new file mode 100644 index 0000000..e574c9d --- /dev/null +++ b/.github/workflows/trigger-template-build.yaml @@ -0,0 +1,23 @@ +name: trigger-template-build +on: + pull_request: + +jobs: + get-code: + runs-on: ubuntu-latest + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v3 + with: + repository: ProjectPythiaCookbooks/cookbook-template + + build: + uses: ProjectPythiaCookbooks/cookbook-actions/.github/workflows/build-book.yaml@main + with: + environment_name: cookbook-dev + environment_file: environment.yml + path_to_notebooks: ./ + use_cached_environment: 'true' # This is default, not strickly needed. Set to 'false' to always build a new environment + \ No newline at end of file From 822207a02c56ee4bab2ab4ed349135171310d296 Mon Sep 17 00:00:00 2001 From: Brian Rose Date: Tue, 4 Oct 2022 18:39:33 -0400 Subject: [PATCH 2/4] Use local version of yaml file for testing --- .github/workflows/trigger-template-build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/trigger-template-build.yaml b/.github/workflows/trigger-template-build.yaml index e574c9d..1b37eb4 100644 --- a/.github/workflows/trigger-template-build.yaml +++ b/.github/workflows/trigger-template-build.yaml @@ -14,7 +14,7 @@ jobs: repository: ProjectPythiaCookbooks/cookbook-template build: - uses: ProjectPythiaCookbooks/cookbook-actions/.github/workflows/build-book.yaml@main + uses: ./.github/workflows/build-book.yaml with: environment_name: cookbook-dev environment_file: environment.yml From 491598b3ea815e7f2cb7f2b3f2295575c915af39 Mon Sep 17 00:00:00 2001 From: Brian Rose Date: Tue, 11 Oct 2022 09:29:55 -0400 Subject: [PATCH 3/4] Add needs --- .github/workflows/trigger-template-build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/trigger-template-build.yaml b/.github/workflows/trigger-template-build.yaml index 1b37eb4..fc5420f 100644 --- a/.github/workflows/trigger-template-build.yaml +++ b/.github/workflows/trigger-template-build.yaml @@ -9,11 +9,13 @@ jobs: run: shell: bash -l {0} steps: - - uses: actions/checkout@v3 + - name: Checkout template repo + uses: actions/checkout@v3 with: repository: ProjectPythiaCookbooks/cookbook-template build: + needs: get-code uses: ./.github/workflows/build-book.yaml with: environment_name: cookbook-dev From a8589407313ad2b9df818e3e0ca1f172af5fb803 Mon Sep 17 00:00:00 2001 From: Brian Rose Date: Tue, 11 Oct 2022 09:43:04 -0400 Subject: [PATCH 4/4] Try issuing a workflow dispatch event --- .github/workflows/trigger-template-build.yaml | 49 ++++++++++++------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/.github/workflows/trigger-template-build.yaml b/.github/workflows/trigger-template-build.yaml index fc5420f..40845a4 100644 --- a/.github/workflows/trigger-template-build.yaml +++ b/.github/workflows/trigger-template-build.yaml @@ -2,24 +2,39 @@ name: trigger-template-build on: pull_request: +# jobs: +# get-code: +# runs-on: ubuntu-latest +# defaults: +# run: +# shell: bash -l {0} +# steps: +# - name: Checkout template repo +# uses: actions/checkout@v3 +# with: +# repository: ProjectPythiaCookbooks/cookbook-template + +# build: +# needs: get-code +# uses: ./.github/workflows/build-book.yaml +# with: +# environment_name: cookbook-dev +# environment_file: environment.yml +# path_to_notebooks: ./ +# use_cached_environment: 'true' # This is default, not strickly needed. Set to 'false' to always build a new environment + jobs: - get-code: + test-template: runs-on: ubuntu-latest - defaults: - run: - shell: bash -l {0} steps: - - name: Checkout template repo - uses: actions/checkout@v3 + - name: Create workflow dispatch to CookbookTemplate repo + uses: actions/github-script@v6 with: - repository: ProjectPythiaCookbooks/cookbook-template - - build: - needs: get-code - uses: ./.github/workflows/build-book.yaml - with: - environment_name: cookbook-dev - environment_file: environment.yml - path_to_notebooks: ./ - use_cached_environment: 'true' # This is default, not strickly needed. Set to 'false' to always build a new environment - \ No newline at end of file + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'ProjectPythiaCookbooks', + repo: 'cookbook-template', + workflow_id: 'nightly-build.yaml', + ref: 'main' + }) \ No newline at end of file