From f2fc6da1928b563646f7cf9682e60a932b8e3b91 Mon Sep 17 00:00:00 2001 From: james Hart Date: Wed, 24 Jul 2024 10:35:33 +0100 Subject: [PATCH] include a little python script --- .github/actions/run-script/action.yml | 14 ++++++++++++ .github/workflows/bootstrap-actions.yml | 30 +++++++++++++++++++++++++ scripts/wait-minutes.py | 16 +++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 .github/actions/run-script/action.yml create mode 100644 .github/workflows/bootstrap-actions.yml create mode 100644 scripts/wait-minutes.py diff --git a/.github/actions/run-script/action.yml b/.github/actions/run-script/action.yml new file mode 100644 index 0000000..6c1ac9f --- /dev/null +++ b/.github/actions/run-script/action.yml @@ -0,0 +1,14 @@ +name: "Run a script" +description: "Runs a script for a number of minutes" +runs: + using: "composite" + steps: + - name: Checkout code + uses: actions/checkout@v4 + - id: run-script + name: Get Service Catalogue Data + run: python3 ./scripts/wait-minutes.py + shell: bash + env: + OPTIONS: "${{ env.options }}" + diff --git a/.github/workflows/bootstrap-actions.yml b/.github/workflows/bootstrap-actions.yml new file mode 100644 index 0000000..e23a5c8 --- /dev/null +++ b/.github/workflows/bootstrap-actions.yml @@ -0,0 +1,30 @@ +# Test workflow +# + +name: Bootstrap Actions Workflow Dispatch + +on: + workflow_dispatch: + inputs: + options: + type: choice + description: 'How many minutes to run for' + required: true + default: '10' + options: + - '1' + - '10' + - '30' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - run: echo "Running a script for ${{ github.event.inputs.options }} 10 minutes" + - name: Checkout code + uses: actions/checkout@v4 + - id: get_sc_data + name: Run a script + uses: ./.github/actions/run-script + env: + options: ${{ github.event.inputs.options }} diff --git a/scripts/wait-minutes.py b/scripts/wait-minutes.py new file mode 100644 index 0000000..6bd1300 --- /dev/null +++ b/scripts/wait-minutes.py @@ -0,0 +1,16 @@ +import os +import sys +from time import sleep + +wait_time=os.getenv('OPTIONS') +sec_count=0 +s="s" if int(wait_time)>1 else "" +print(f'Doing very little for {wait_time} minute{s}') +while sec_count