Skip to content

Commit cd96715

Browse files
committed
test
1 parent ee5e5a4 commit cd96715

File tree

1 file changed

+32
-18
lines changed

1 file changed

+32
-18
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
echo "Validating if ${{ github.actor }} is a Code Owner..."
2020
2121
# Lista de Code Owners
22-
CODEOWNERS=("paula-encinar")
22+
CODEOWNERS=("paula-encinar" "antonio-ailabs" "marcos-rodriguez-insud")
2323
2424
# Convertir el actor actual a minúsculas para comparación
2525
GITHUB_ACTOR_LOWER=$(echo "${{ github.actor }}" | tr '[:upper:]' '[:lower:]')
@@ -35,32 +35,26 @@ jobs:
3535
needs: validate-codeowner
3636
runs-on: ubuntu-latest
3737

38-
steps:
39-
# Paso 2: Seleccionar el Token del Code Owner basado en github.actor
40-
- name: Select Code Owner Token
41-
id: select-token
42-
run: |
43-
echo "Selecting token for ${{ github.actor }}..."
44-
TOKEN_ENV_NAME=$(echo "${{ github.actor }}" | tr '[:lower:]' '[:upper:]' | tr '-' '_' )_TOKEN
45-
echo "TOKEN_ENV_NAME=${TOKEN_ENV_NAME}" >> $GITHUB_ENV
46-
echo "Selected token environment variable: $TOKEN_ENV_NAME"
38+
permissions:
39+
contents: write
40+
pull-requests: write
4741

48-
# Paso 3: Autenticar GitHub CLI con el Token seleccionado
49-
- name: Authenticate GitHub CLI with Selected Token
42+
steps:
43+
# Paso 2: Autenticar GitHub CLI con el GITHUB_TOKEN
44+
- name: Authenticate GitHub CLI with GITHUB_TOKEN
5045
run: |
51-
echo "Authenticating GitHub CLI with the token for ${{ github.actor }}..."
52-
gh auth logout || true
53-
echo "${{ secrets[env.TOKEN_ENV_NAME] }}" | gh auth login --with-token
46+
echo "Authenticating GitHub CLI with GITHUB_TOKEN..."
47+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
5448
55-
# Paso 4: Crear la Pull Request
49+
# Paso 3: Crear la Pull Request con el GITHUB_TOKEN
5650
- name: Create Pull Request
5751
id: create_pr
5852
run: |
5953
PR_OUTPUT=$(gh pr create \
6054
--base main \
6155
--head ${{ github.event.inputs.target_branch }} \
6256
--title "Merge ${{ github.event.inputs.target_branch }} into main" \
63-
--body "This PR was created and approved by ${{ github.actor }} using their own PAT." \
57+
--body "This PR was created automatically using GITHUB_TOKEN." \
6458
--label automerge)
6559
echo "PR created: $PR_OUTPUT"
6660
@@ -79,7 +73,23 @@ jobs:
7973
runs-on: ubuntu-latest
8074

8175
steps:
82-
# Paso 5: Aprueba la PR con el mismo Token seleccionado
76+
# Paso 4: Seleccionar el Token del Code Owner basado en github.actor
77+
- name: Select Code Owner Token
78+
id: select-token
79+
run: |
80+
echo "Selecting token for ${{ github.actor }}..."
81+
TOKEN_ENV_NAME=$(echo "${{ github.actor }}" | tr '[:lower:]' '[:upper:]' | tr '-' '_' )_TOKEN
82+
echo "TOKEN_ENV_NAME=${TOKEN_ENV_NAME}" >> $GITHUB_ENV
83+
echo "Selected token environment variable: $TOKEN_ENV_NAME"
84+
85+
# Paso 5: Autenticar GitHub CLI con el Token seleccionado
86+
- name: Authenticate GitHub CLI with Selected Token
87+
run: |
88+
echo "Authenticating GitHub CLI with the token for ${{ github.actor }}..."
89+
gh auth logout || true
90+
echo "${{ secrets[env.TOKEN_ENV_NAME] }}" | gh auth login --with-token
91+
92+
# Paso 6: Aprobar la PR con el Token del Code Owner
8393
- name: Approve Pull Request with Selected Token
8494
run: |
8595
echo "Approving the PR #${{ needs.create-pr.outputs.pr_number }} with the token for ${{ github.actor }}..."
@@ -89,6 +99,10 @@ jobs:
8999
needs: [create-pr, approve-pr]
90100
runs-on: ubuntu-latest
91101

102+
permissions:
103+
contents: write
104+
pull-requests: write
105+
92106
steps:
93107
# Habilitar Auto-Merge para la PR con etiqueta 'automerge'
94108
- name: Enable Auto-Merge

0 commit comments

Comments
 (0)