Github Action pipeline:
name: "tm-smart-contracts-generate-posting-lib" # **What it does**: Renders the content of every page and check all internal links. # **Why we have it**: To make sure all links connect correctly. # **Who does it impact**: Docs content. on: push: branches: - main paths: - tm-contracts/postingslib/** - common/tm-client/transactionsDefinitions.yml - .github/workflows/smart-contract-generate-posting-lib.yaml jobs: generate_posting: runs-on: ubuntu-22.04 permissions: contents: write steps: - name: Import Secrets id: secrets uses: hashicorp/vault-action@v2.4.2 with: url: ${{ secrets.VAULT_ADDR }} token: ${{ secrets.VAULT_TOKEN }} secrets: | secret/data/brave/apps/tm/manual tm_auth_token | TM_AUTH_TOKEN - name: Checkout safi mono project uses: actions/checkout@v3 with: persist-credentials: false path: source - name: Check out tm-contracts sdk repo uses: actions/checkout@v3 with: ref: main path: tm-contracts-sdk repository: SafiBank/tm-contracts-sdk ssh-key: ${{ secrets.TM_CONTRACTS_SDK_PRIVATE_KEY }} - name: Setup python uses: actions/setup-python@v4 with: python-version: '3.10' cache: 'pip' # cache pip dependencies - name: Check python version run: python3 -V - name: Install python dependencies run: pip install -r ${GITHUB_WORKSPACE}/source/tm-contracts/smart_contracts/requirements.txt - name: Update the privilege run: chmod +x ${GITHUB_WORKSPACE}/source/tm-contracts/postingslib/generate-postings-lib.sh - name: Execute generating postings lib scripts run: cd ${GITHUB_WORKSPACE}/source/tm-contracts/postingslib && ./generate-postings-lib.sh shell: bash - name: Commit & Push changes uses: actions-js/push@master with: directory: source branch: saf-posting-lib-${{ github.sha }} github_token: ${{ secrets.GITHUB_TOKEN }} repository: SafiBank/SaFiMono message: 'github action generating posting lib' # create_posting_pull_request: # needs: generate_posting # runs-on: "ubuntu-latest" # permissions: # contents: read # pull-requests: write # repository-projects: write # steps: # - name: Checkout safi mono project # uses: actions/checkout@v3 # with: # repository: SafiBank/SaFiMono # - name: Create Python Posting lib Pull Request # uses: devops-infra/action-pull-request@v0.5.3 # with: # github_token: ${{ secrets.GITHUB_TOKEN }} # source_branch: saf-posting-lib-${{ github.sha }} # target_branch: main # title: Generating posting lib # reviewer: ${{ github.actor }} # label: Loans # get_diff: true
Posting Configuration file:
https://github.com/SafiBank/SaFiMono/blob/main/common/tm-client/transactionsDefinitions.yml
Steps to generating posting.py
Update the transactionsDefinitions.yml configuration files
It will trigger the pipeline to generate a posting.py file https://github.com/SafiBank/SaFiMono/actions/runs/3949847719, It can’t create the pull request automatically due to missing some privileges.
After talked with zhenghong.li (Unlicensed) , we decide to create pull request manually.
The pipeline will create a branch with a prefix 'saf-posting-lib'
https://github.com/SafiBank/SaFiMono/branches/all?query=saf-posting-lib
Then you can create a new pull request with this branch and add reviewers to review.