Internal (personal) Action to Init my Repositories following my internal rules
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:
repository
from the specified template
(if asked)repository
repository_deployment
with the help of the
generate-ssh-deploy-repo-action action, if repository_deployment
is defined.testspace_domain
if asked with testspace_link_enable
parameter.delete-workflow
option):
$
character.
For example the $.github
directory will be renamed to .github
.
If the final directory exists, it is replaced with the content of the renamed directory.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
- 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
- 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
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 |
The token must have the following permissions:
repository
(if requested i.e. if a template is defined)repository_deployment
repository
and commit to the repository
repository
repository
with the template resolution.github
directory (from a template $.github
directory)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. |
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
and tests results are send to TestSpace:
For exemple the "tool" test suite contains the following tests:
The scripts and documentation in this project are released under the MIT License