From 713dae4044621ee831c1bdabba70f43bb4452d77 Mon Sep 17 00:00:00 2001 From: Jack Baldry Date: Thu, 27 Jun 2024 12:11:13 +0100 Subject: [PATCH] Fix workflow for regenerating tutorials when there's an existing PR Signed-off-by: Jack Baldry --- .github/workflows/regenerate-tutorials.yml | 6 ++- scripts/check-out-branch.bash | 43 ++++++++++++++++++++++ scripts/manage-pr.bash | 38 +++++++++---------- 3 files changed, 64 insertions(+), 23 deletions(-) create mode 100755 scripts/check-out-branch.bash diff --git a/.github/workflows/regenerate-tutorials.yml b/.github/workflows/regenerate-tutorials.yml index 0a4c5e5..c0171ec 100644 --- a/.github/workflows/regenerate-tutorials.yml +++ b/.github/workflows/regenerate-tutorials.yml @@ -16,19 +16,21 @@ jobs: path: loki - uses: actions/checkout@v4 with: - ref: staging path: killercoda - uses: actions/setup-go@v5 with: go-version-file: killercoda/tools/transformer/go.mod - run: go build ./ working-directory: killercoda/tools/transformer + - run: ./scripts/check-out-branch.bash + shell: bash + working-directory: killercoda - run: > ./transformer "${GITHUB_WORKSPACE}/loki/docs/sources/get-started/quick-start.md" "${GITHUB_WORKSPACE}/killercoda/loki/loki-quickstart" working-directory: killercoda/tools/transformer - - run: ./scripts/manage-pr.bash + - run: ./scripts/open-pr.bash env: GH_TOKEN: ${{ github.token }} shell: bash diff --git a/scripts/check-out-branch.bash b/scripts/check-out-branch.bash new file mode 100755 index 0000000..7bf54ba --- /dev/null +++ b/scripts/check-out-branch.bash @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +set -euf -o pipefail + +function usage { + cat <