66 lines
1.9 KiB
Text
66 lines
1.9 KiB
Text
# Use gh as a credential helper
|
|
exec gh auth setup-git
|
|
|
|
# Create a repository with a file so it has a default branch
|
|
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private
|
|
|
|
# Defer repo cleanup
|
|
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING
|
|
|
|
# Clone the repo
|
|
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING
|
|
|
|
# commit the workflow file
|
|
cd $SCRIPT_NAME-$RANDOM_STRING
|
|
mkdir .github/workflows
|
|
mv ../workflow.yml .github/workflows/workflow.yml
|
|
exec git add .github/workflows/workflow.yml
|
|
exec git commit -m 'Create workflow file'
|
|
exec git push -u origin main
|
|
|
|
# Sleep because it takes a second for the workflow to register
|
|
sleep 1
|
|
|
|
# Check the workflow is indeed created
|
|
exec gh workflow list
|
|
stdout 'Test Workflow Name'
|
|
|
|
# disable the workflow
|
|
exec gh workflow disable 'Test Workflow Name'
|
|
|
|
# Check that the listing shows it is disabled
|
|
exec gh workflow list --all
|
|
stdout 'Test\s+Workflow\s+Name\s+disabled_manually\s+\d+'
|
|
|
|
# enable the workflow
|
|
exec gh workflow enable 'Test Workflow Name'
|
|
|
|
# Check the workflow is indeed enabled
|
|
exec gh workflow list
|
|
stdout 'Test\s+Workflow\s+Name\s+active\s+\d+'
|
|
|
|
-- workflow.yml --
|
|
# This is a basic workflow to help you get started with Actions
|
|
|
|
name: Test Workflow Name
|
|
|
|
# Controls when the workflow will run
|
|
on:
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
# This workflow contains a single job called "build"
|
|
build:
|
|
# The type of runner that the job will run on
|
|
runs-on: ubuntu-latest
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
|
- uses: actions/checkout@v4
|
|
|
|
# Runs a single command using the runners shell
|
|
- name: Run a one-line script
|
|
run: echo Hello, world!
|