Skip to content

Commit

Permalink
Merge pull request #18 from szepeviktor/patch-2
Browse files Browse the repository at this point in the history
Use GitHub CLI
  • Loading branch information
pedro-mendonca authored Apr 17, 2024
2 parents bf609d8 + 9be7091 commit b8ed3cd
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/update-build-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,28 +106,26 @@ jobs:

- name: Check if Pull Request exists
id: check_pr
env:
GH_TOKEN: "${{ github.token }}"
run: |
BRANCH=main
RESPONSE=$(curl -X GET -H "Authorization: token $TOKEN" "https://api.github.com/repos/$REPO/pulls?head=$OWNER:english")
PR_NUMBER=$(echo "$RESPONSE" | jq -r '.[].number')
PR_NUMBER="$(gh pr list --head "${OWNER}:english" --json "number" --jq '.[0]."number"')"
if [ -n "$PR_NUMBER" ]; then
echo "PR number found: $PR_NUMBER"
echo "pr_number=$PR_NUMBER" >> $GITHUB_OUTPUT
else
echo "No pull request found."
fi
- name: Create new Pull Request
- name: Create Pull Request
id: create_pr
if: steps.check_pr.outputs.pr_number == ''
env:
TITLE: "Actualizar ficheiros originais em inglês"
BODY: "Actualização automática para submeter alterações do branch 'english' para o 'main'."
GH_TOKEN: "${{ github.token }}"
run: |
BRANCH=main
TITLE="Actualizar ficheiros originais em inglês"
BODY="Actualização automática para submeter alterações do branch 'english' para o 'main'."
URL="https://api.github.com/repos/$REPO/pulls"
RESPONSE=$(curl -X POST -H "Authorization: token $TOKEN" -d "{\"title\":\"$TITLE\",\"body\":\"$BODY\",\"head\":\"english\",\"base\":\"$BRANCH\"}" $URL)
echo $RESPONSE
gh pr create --title "${TITLE}" --body "${BODY}" --head "english" --base "main"
- name: Steps debug info
run: |
Expand Down

0 comments on commit b8ed3cd

Please sign in to comment.