@@ -3,23 +3,38 @@ name: Agrega comentario a PR
3
3
on :
4
4
pull_request_target :
5
5
6
+ permissions :
7
+ contents : read
8
+
6
9
jobs :
7
- pr -comment :
10
+ define -comment :
8
11
name : Entradas sin traducción
9
12
runs-on : ubuntu-22.04
13
+ outputs :
14
+ any_changed : ${{ steps.changed-files.outputs.any_changed }}
15
+ comment : ${{ steps.create-pr-comment.outputs.comment }}
10
16
steps :
11
17
- uses : actions/checkout@v4
12
18
with :
13
19
ref : ${{ github.event.pull_request.head.sha }}
14
20
persist-credentials : false
15
21
- name : Preparar Python v3.11
16
- uses : actions/setup-python@v4
22
+ uses : actions/setup-python@v5
17
23
with :
18
24
python-version : " 3.11"
19
25
cache : " pip"
26
+ # checkout these files from the base branch to guarantee they haven't been
27
+ # modified by the PR
28
+ - uses : actions/checkout@v4
29
+ with :
30
+ path : base-branch
31
+ sparse-checkout-cone-mode : false
32
+ sparse-checkout : |
33
+ requirements.txt
34
+ scripts/list_missing_entries.py
20
35
- name : Instalar dependencias
21
36
run : |
22
- python -m pip install -r requirements.txt
37
+ python -m pip install -r base-branch/ requirements.txt
23
38
- name : Obtiene lista de archivos con cambios
24
39
id : changed-files
25
40
uses : tj-actions/changed-files@v40
@@ -34,12 +49,20 @@ jobs:
34
49
run : |
35
50
{
36
51
echo 'comment<<EOF'
37
- python scripts/list_missing_entries.py --github $CHANGED_PO_FILES
52
+ python base-branch/ scripts/list_missing_entries.py --github $CHANGED_PO_FILES
38
53
echo EOF
39
54
} >> "$GITHUB_OUTPUT"
55
+
56
+ write-comment :
57
+ runs-on : ubuntu-22.04
58
+ needs : [define-comment]
59
+ if : needs.define-comment.outputs.any_changed == 'true'
60
+ permissions :
61
+ issues : write
62
+ pull-requests : write
63
+ steps :
40
64
- name : Agregar comentario con entradas faltantes
41
- if : steps.changed-files.outputs.any_changed == 'true'
42
65
uses : thollander/actions-comment-pull-request@v2
43
66
with :
44
- message : ${{ steps.create-pr -comment.outputs.comment }}
67
+ message : ${{ needs.define -comment.outputs.comment }}
45
68
comment_tag : missing-entries
0 commit comments