Skip to content

Initial commit

Initial commit #1

Workflow file for this run

name: Execute template to populate repository
on:
push:
workflow_dispatch:
jobs:
setup-repo:
if: ${{ github.repository != 'Sydney-Informatics-Hub/template-nf' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Install cookiecutter
run: pip3 install cookiecutter
- uses: actions/github-script@v4
id: fetch-repo-and-user-details
with:
script: |
const query = `query($owner:String!, $name:String!) {
repository(owner:$owner, name:$name) {
name
description
owner {
login
... on User {
name
}
... on Organization {
name
}
}
}
}`;
const variables = {
owner: context.repo.owner,
name: context.repo.repo
}
const result = await github.graphql(query, variables)
return result
- name: Build out template
env:
INFO: ${{ steps.fetch-repo-and-user-details.outputs.result }}
run: |
export REPO_NAME=$(echo $INFO | jq -r '.repository.name')
# Run cookiecutter
pushd /tmp
cookiecutter gh:Sydney-Informatics-Hub/Nextflow_DSL2_template --no-input \
app_name=$REPO_NAME \
description="$(echo $INFO | jq -r .repository.description)" \
github_username="$(echo $INFO | jq -r .repository.owner.login)" \
author_name="$(echo $INFO | jq -r .repository.owner.name)"
popd
# Delete the .github directory and README, they're not needed anymore
rm -rf .github/
rm -rf Images/
rm -rf README.md
shopt -s dotglob
# Move template content to root, ensure hidden and README are replaced
rsync -a /tmp/$REPO_NAME/ .
- name: Force push changes to main
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Build skeleton template"
push_options: "--force"