Skip to content

Run Test

Run Test #83

Workflow file for this run

name: 'Run Test'
on:
workflow_dispatch:
inputs:
microservice_name:
description: 'New microservice name'
required: true
type: string
boilerplate_type:
description: 'Boilerplate type'
required: true
type: choice
options:
- "Java with UI"
env:
# TODO change to main
src_repo_branch: "master"
PAT: ${{ secrets.PAT }} # Personal Access Token
MICROSERVICE_NAME: ${{ inputs.microservice_name }}
ORG_NAME: "jsonar"
jobs:
create_new_microservice:
name: 'Create New Microservice'
# Use Ubuntu Sonar runners which IPs are allow-listed
# runs-on: [self-hosted, ubuntu]
runs-on: ubuntu-latest
container: pandoc/latex
defaults:
run:
shell: bash
steps:
# - name: Validate source repo branch
# run: |
# if [ "${GITHUB_REF##*/}" != "${src_repo_branch}" ]; then
# echo "Invalid branch. This workflow can only be run from '${src_repo_branch}' branch. Got '${GITHUB_REF##*/}'."
# exit 1
# fi
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ env.src_repo_branch }}
# - name: Create a New Repo
# run: |
# echo "Creating new microservice"
# echo "Microservice Name: ${{ inputs.microservice_name }}"
# echo "Boilerplate Type: ${{ inputs.boilerplate_type }}"
# curl -X POST \
# -H "Authorization: token $PAT" \
# -H "Accept: application/vnd.github.v3+json" \
# "https://api.github.com/orgs/$ORG_NAME/repos" \
# -d "{\"name\": \"$MICROSERVICE_NAME\", \"private\": true}"
#
# echo "Repository $MICROSERVICE_NAME created under organization $ORG_NAME"
- name: Git add config
run: |
set -x
cat ./.git/config
git config --unset-all http.https://github.com/.extraheader
# - name: Deploy template
# uses: cpina/github-action-push-to-another-repository@main
# env:
# API_TOKEN_GITHUB: ${{ secrets.PAT }}
# with:
# source-directory: "."
# destination-github-username: ${{ env.ORG_NAME }}
# destination-repository-name: ${{ env.MICROSERVICE_NAME }}
# target-branch: main
- name: Set remote URL
run: |
cat ./.git/config
git remote -v
git remote set-url origin https://[email protected]/$ORG_NAME/$MICROSERVICE_NAME.git
- name: Push to branch
run: |
cat ./.git/config
git remote -v
git branch -M main
git push -u origin main