Corrigindo o bot #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build LaTeX document | |
on: pull_request | |
jobs: | |
build_latex: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v3 | |
- name: Compile LaTeX document | |
uses: xu-cheng/latex-action@v2 | |
with: | |
root_file: main.tex | |
working_directory: article/ | |
continue_on_error: true | |
- name: Save PDF as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: main | |
path: article/main.pdf | |
- name: comment PR | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const artifactUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${process.env.GITHUB_RUN_ID}`; | |
const formatDate = (date) => { | |
const day = String(date.getDate()).padStart(2, '0'); | |
const month = String(date.getMonth() + 1).padStart(2, '0'); //January is 0! | |
const year = date.getFullYear(); | |
const hours = String(date.getHours()).padStart(2, '0'); | |
const minutes = String(date.getMinutes()).padStart(2, '0'); | |
return day + '/' + month + '/' + year + ' ' + hours + ':' + minutes; | |
} | |
const currentDate = new Date().toLocaleString("pt-BR", {timeZone: "America/Sao_Paulo"}); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `👋 Aqui está uma nova versão do artigo em PDF: [link](${artifactUrl}). Lançado em ${currentDate}.` | |
}) |