fletort / init-repo-action

Internal Action to Init My repositories following internal rules
MIT License
0 stars 0 forks source link

init-repo-action

Internal (personal) Action to Init my Repositories following my internal rules

Continuous Testing

This personal action was created to can have an unique code/procedure to create my repor whatever the context.

Actually my repositories can be created from:

Behaviour

We recommend using a service account with the least permissions necessary. Also when generating a new PAT, select the least scopes necessary. Learn more about creating and using encrypted secrets

Usage

Used as a tool

- uses: fletort/init-repo-action@v1
  with:
    repository: owner/my_repo_to_create
    template: owner/my_template_repo
    repository_deployment: owner/repo_on_which_we_can_deploy
    token: ${{ secrets.PAT }}
    testspace_link_enable: true
    testspace_token: ${{ secrets.TESTSPACE_TOKEN }}
    testspace_domain: testspace_domain

You can also pin to a specific release version in the format @v1.x.x

Used from a repo that init itself

- uses: fletort/init-repo-action@v1
  with:
    repository_deployment: owner/repo_on_which_we_can_deploy
    token: ${{ secrets.PAT }}
    testspace_link_enable: true
    testspace_token: ${{ secrets.TESTSPACE_TOKEN }}

You can also pin to a specific release version in the format @v1.x.x

To have a dynamic template feature you can call this action on the create event:

name: Init Repository and Resolve Dynamic Template
on:
  - create

jobs:
  init_repo:
    name: Init Repository
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - name: Checkout
        id: checkout
        uses: fletort/init-repo-action@v1
        with:
          repository_deployment: owner/repo_on_which_we_can_deploy
          token: ${{ secrets.PAT }}
          testspace_link_enable: true
          testspace_token: ${{ secrets.TESTSPACE_TOKEN }}

See my template-common-js template init workflow for an up to date Dynamic Template worflow

Actions inputs

Only inputs specified in the "init itself" usage upper are mandatories. All other inputs are optional.

Name Description Default
repository Repository to create and/or init. Indicate the repository name with owner. ${{ github.repository }}
template Template Repository to use to create the repository. Indicate the repository name with owner. If the repository is already created, indicates no_init no_init
repository_deployment Repository on which repository will be able to deploy to through ssh credentials. Indicate the repository name with owner. If not defined (default value), the deployement feature is not initialized. ``
token The token that action (and used actions) will use. See token. MANDATORY
testspace_link_enable Enable or Disable the TestPace project creation Feature. Put true to enable. false
testspace_token Personal testspace token used to interact with the testspace API to create the project MANDATORY if testspace feature is enabled with testspace_link_enable
testspace_domain Testspace SubDomain where the testspace project will be created ${{ github.repository_owner }}
delete_workflow Indicates if the workflow contening the call to this action must be deleted true
j2_keep_template Put to true to keep original template file. See keep_template input of fletort/jinja2-template-action. false
j2_data_file Source file contening inputs variable for the jinja template. See data_file input of fletort/jinja2-template-action. ''
j2_data_format Format of the data_file. Can be env, ini, yaml, json or automatic (for automatic detection). The automatic detction is based on the file extension then on the file content. See data_format input of fletort/jinja2-template-action. automatic

token

The token must have the following permissions:

Template Specific Content

As this action used the fletort/jinja2-template-action, your template can include jinja2 syntax. See official Jinja2 Template Designer Documentation.

Specific Variable are injected by this action, and can be used in your template : Name Description
REPOSITORY_PATH Repository that is initalized (with the owner). It is the value of the repository input.
TESTSPACE_SPACE_ID ID of the created Testspace Space. This is the output of the fletort/testspace-create-action. If not testspace space is initialized (testspace_link_enable to false), the value of TESTSPACE_SPACE_ID is empty.
DEPLOYMENT_REPO_PATH Repository on which deployment is possible (with the owner). It is the value of the repository_deployment input. If no deployment feature is not initialized, the value of DEPLOYMENT_REPO_PATH is empty.

Code Quality

All unit/functional test executed on each branch/PR are listed/described on this testspace space.

2 functionals (integration) testsuites are executed on github pipelines alt

and tests results are send to TestSpace:

alt

For exemple the "tool" test suite contains the following tests:

alt

License

The scripts and documentation in this project are released under the MIT License