Skip to content

Commit

Permalink
ci(BACK-7982): add workflow to format descriptors (#90)
Browse files Browse the repository at this point in the history
* ci(BACK-7982): add workflow to format descriptors

see LedgerHQ/python-erc7730#147
job runs daily and opens a pull request with formatted descriptors

* ci(BACK-7982): fixes

* ci(BACK-7982): simplify
  • Loading branch information
jnicoulaud-ledger authored Nov 18, 2024
1 parent 5f4bed3 commit dfab2a1
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
name: 🤖 format descriptors

on:
schedule:
- cron: '0 7 * * *'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BRANCH: "master"

jobs:
format:
name: format descriptors
runs-on: public-ledgerhq-shared-small
timeout-minutes: 60
steps:

- name: Checkout
timeout-minutes: 10
uses: actions/checkout@v4

- name: Get date
timeout-minutes: 10
run: echo "CURRENT_DATE=$(date +"%Y-%m-%d %H:%M")" >> $GITHUB_ENV

- name: Setup python
timeout-minutes: 10
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'

- name: Login to Ledger JFrog
timeout-minutes: 10
uses: LedgerHQ/actions-security/actions/jfrog-login@actions/jfrog-login-1

- name: Setup pip
timeout-minutes: 10
run: jf pipc --global --repo-resolve=virtual-pypi-prod-green

- name: Install ERC-7730 library
timeout-minutes: 10
run: jf pip install erc7730

- name: Format ERC-7730 descriptors
timeout-minutes: 10
run: erc7730 format

- name: Check changes
id: changes
timeout-minutes: 10
shell: bash
run: |
[[ -n "$(git status -s)" ]] && echo "changes=true" >> $GITHUB_OUTPUT || true
- name: Open pull request
if: ${{ !cancelled() && steps.changes.outputs.changes == 'true' }}
timeout-minutes: 10
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.CI_BOT_TOKEN }}
author: ${{ secrets.CI_BOT_USERNAME }} <${{ secrets.CI_BOT_USERNAME }}@users.noreply.github.com>
branch: ${{ env.BRANCH }}-format-descriptors
base: ${{ env.BRANCH }}
delete-branch: false
commit-message: 'chore: format descriptors - ${{ env.CURRENT_DATE }}'
title: 'chore: format descriptors - ${{ env.CURRENT_DATE }}'
body: ${{ steps.submodules.outputs.prBody }}
draft: false
signoff: false

0 comments on commit dfab2a1

Please sign in to comment.