Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

-- Arquivado por Foundation Platform dia 2024-02-08 (confirmado por [email protected])

Notifications You must be signed in to change notification settings

stone-payments/sre-platform-template-setup

Repository files navigation

SRE Platform Template Setup

This action is useful to setup a template repository. Giving a JSON file, the action will replace its values with the ones defined in the JSON.

For example, if we have an YAML file in the repository:

repositoryName: sre-platform-template-setup

And we use the JSON file below as a input to the action:

{
    "sre-platform": "repository"
}

The action will replace the content of the YAML file to:

repositoryName: repository-template-setup

Inputs

setup-file

Required The path to the JSON file to be used.

Example usage

The snippet below is a complete example of an repository being set up by this action. The repository is replaced and the result is committed and pushed to the main branch:

on: [push]

jobs:
  setup_repository:
    runs-on: ubuntu-latest
    name: Job to set up the repository
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Repository
        uses: stone-payments/sre-platform-template-setup@main
        with:
          setup-file: path-to/file.json

      - name: Commit files
        run: |
          git config --global --add safe.directory "$GITHUB_WORKSPACE"
          git config --local user.email "sreplatform[bot]@stone.com.br"
          git config --local user.name "SRE-Platform[bot]"
          git add .
          git commit -m "[bot] Initial repository setup"

      - name: Push changes to main
        uses: ad-m/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: main