This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
53 lines (46 loc) · 2.25 KB
/
Reviw-Rover-002.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Dispatch para activar el bot
on:
issue_comment:
types:
- created
- edited
jobs:
activate-bot:
runs-on: ubuntu-latest
steps:
- name: Verificar comando de activación
id: check-command
run: |
if [[ $(echo "${{ github.event.comment.body }}" | grep -E '/continuar') ]]; then
echo "::set-output name=activate::true"
fi
- name: Ejecutar bot si se activa
if: steps.check-command.outputs.activate == 'true'
run: |
# Recopilar los datos del usuario desde la conversación del Issue
repositoryURL=$(jq -r '.comment.body' ${{ steps.wait-for-user-response.outputs.response-file }} | grep -oP 'repositoryURL:\s*\K[^\n]*')
language=$(jq -r '.comment.body' ${{ steps.wait-for-user-response.outputs.response-file }} | grep -oP 'language:\s*\K[^\n]*')
symbol=$(jq -r '.comment.body' ${{ steps.wait-for-user-response.outputs.response-file }} | grep -oP 'symbol:\s*\K[^\n]*')
year=$(jq -r '.comment.body' ${{ steps.wait-for-user-response.outputs.response-file }} | grep -oP 'year:\s*\K[^\n]*')
# Descargar todos los archivos del repositorio y crear ZIP
git clone $repositoryURL repo
repo_name=$(basename $repositoryURL)
cd repo
git archive -o temp-files/repo_files.zip HEAD
# Subir el archivo ZIP a GitHub
response=$(curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: application/zip" \
--data-binary @repo_files.zip \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/attachments")
# Extraer la URL del archivo cargado
attachment_url=$(echo "$response" | jq -r .url)
# Agregar un comentario con el enlace al archivo
comment="Aquí tienes el archivo ZIP: $attachment_url"
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments" \
-d "{
\"body\": \"$comment\"
}"