Skip to content

Commit

Permalink
include a little python script
Browse files Browse the repository at this point in the history
  • Loading branch information
james-jdgtl committed Jul 24, 2024
1 parent 061dfcd commit f2fc6da
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/actions/run-script/action.yml
Original file line number Diff line number Diff line change
@@ -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 }}"

30 changes: 30 additions & 0 deletions .github/workflows/bootstrap-actions.yml
Original file line number Diff line number Diff line change
@@ -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 }}
16 changes: 16 additions & 0 deletions scripts/wait-minutes.py
Original file line number Diff line number Diff line change
@@ -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<int(wait_time)*30:
if sec_count%30==0:
s="" if sec_count==30 else "s"
print(f'\n{str(int(sec_count/30))} minute{s}')
print(".", end="")
sleep(2)
sys.stdout.flush()
sec_count+=1

0 comments on commit f2fc6da

Please sign in to comment.