Skip to content

Commit

Permalink
Use repo data instead of hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
pedro-mendonca committed Apr 16, 2024
1 parent d615e3a commit 2ee9bbd
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/update-build-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ on:
workflow_dispatch:

env:
OWNER: wp-portugal
REPO: wp-portugal-i18n-build-files
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} # Access Token with write permissions.
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}

permissions:
contents: write
pull-requests: write

jobs:

Expand Down Expand Up @@ -104,7 +105,7 @@ jobs:
id: check_pr
run: |
BRANCH=main
RESPONSE=$(curl -X GET -H "Authorization: token $ACCESS_TOKEN" "https://api.github.com/repos/$OWNER/$REPO/pulls?head=$OWNER:trunk")
RESPONSE=$(curl -X GET -H "Authorization: token $TOKEN" "https://api.github.com/repos/$REPO/pulls?head=$OWNER:trunk")
PR_NUMBER=$(echo "$RESPONSE" | jq -r '.[].number')
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
Expand All @@ -115,8 +116,8 @@ jobs:
BRANCH=main
TITLE="Actualizar ficheiros originais em inglês"
BODY="Este pull request automático submete alterações do branch 'trunk' para o 'main'."
URL="https://api.github.com/repos/$OWNER/$REPO/pulls"
RESPONSE=$(curl -X POST -H "Authorization: token $ACCESS_TOKEN" -d "{\"title\":\"$TITLE\",\"body\":\"$BODY\",\"head\":\"trunk\",\"base\":\"$BRANCH\"}" $URL)
URL="https://api.github.com/repos/$REPO/pulls"
RESPONSE=$(curl -X POST -H "Authorization: token $TOKEN" -d "{\"title\":\"$TITLE\",\"body\":\"$BODY\",\"head\":\"trunk\",\"base\":\"$BRANCH\"}" $URL)
echo $RESPONSE
- name: Steps debug info
Expand Down

0 comments on commit 2ee9bbd

Please sign in to comment.