Skip to content

formularios: Señales continuas #26

formularios: Señales continuas

formularios: Señales continuas #26

name: Formatear Formularios
on:
workflow_dispatch:
inputs:
ref_commit:
description: 'Commit de referencia, puede ser HEAD o similar'
required: true
type: string
branch_name:
description: 'Rama en la que se desea ejecutar (default = main)'
default: 'main'
type: string
push:
paths:
- "formularios/*.md"
pull_request:
paths:
- "formularios/*.md"
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Acondicionar git # Necesario para que git diff funcione correctamente con archivos UTF-8
run: git config --global core.quotepath off
- uses: actions/checkout@v4.1.2
with:
ref: ${{ (github.event_name == 'workflow_dispatch') && format('refs/heads/{0}', github.event.inputs.branch_name) || github.ref }}
fetch-depth: 15
- name: Agregar bloques de código a los formularios
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]
then
IFS=$'\n' read -r -d '' -a files < <( git diff --name-only ${{ github.event.inputs.ref_commit }} HEAD && printf '\0' )
else
IFS=$'\n' read -r -d '' -a files < <( git diff --name-only ${{ github.event.before }} ${{ github.sha }} && printf '\0' )
fi
for file in "${files[@]}"
do
if [[ $file == *.md ]] && [[ -f "$file" ]]
then
python .github/scripts/agregar_bloque_math.py "$file"
fi
done
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "workflow(formularios): Agregar bloques de código"
- name: Prettify code
uses: creyD/prettier_action@v4.3
with:
prettier_options: "--write **/*.md"
commit_message: "estilo{.md}: Prettier"