mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-23 20:12:09 +03:00
Use personal token to create pull request for update_crates.yml action
This commit is contained in:
parent
e446ce1cda
commit
1e1c2a01bd
19
.github/workflows/update-crates.yml
vendored
19
.github/workflows/update-crates.yml
vendored
@ -32,6 +32,7 @@ jobs:
|
|||||||
echo " - ❌ A problem occurs updating crates. Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
|
echo " - ❌ A problem occurs updating crates. Please refer to ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID} logs."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Get actual pull request id
|
- name: Get actual pull request id
|
||||||
run: |
|
run: |
|
||||||
ACTUAL_PR_NUMBER=$(gh pr list --repo "${REPO}" --head "${BOT_UPDATE_BRANCHE_NAME}" --state "open" --json number --jq .[].number)
|
ACTUAL_PR_NUMBER=$(gh pr list --repo "${REPO}" --head "${BOT_UPDATE_BRANCHE_NAME}" --state "open" --json number --jq .[].number)
|
||||||
@ -80,8 +81,18 @@ jobs:
|
|||||||
echo " - ❌ Git push command succeeds but origin/${BOT_UPDATE_BRANCHE_NAME} still does not exist on remote."
|
echo " - ❌ Git push command succeeds but origin/${BOT_UPDATE_BRANCHE_NAME} still does not exist on remote."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Create new pull request
|
- name: Create new pull request
|
||||||
run: |
|
run: |
|
||||||
|
GITHUB_TOKEN=${{ secrets.LEPAPAREIL_CI_TOKEN }}
|
||||||
|
gh pr create --fill --base master --head "${BOT_UPDATE_BRANCHE_NAME}" && gh_exit_code=0 || gh_exit_code=$?
|
||||||
|
if [ ${gh_exit_code} -eq 0 ] ; then
|
||||||
|
NEW_PR_NUMBER=$(gh pr list --repo "${REPO}" --head "${BOT_UPDATE_BRANCHE_NAME}" --state "open" --json number --jq .[].number)
|
||||||
|
echo " - ✅ Creation of pull request n°${NEW_PR_NUMBER} succeeds."
|
||||||
|
else
|
||||||
|
echo " - ❌ A problem occurs when attempting to create new pull request."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
pr_comment_file="comment_file.md"
|
pr_comment_file="comment_file.md"
|
||||||
(grep -vE "newest|crates.io index" "${update_crates_output}" || true) | \
|
(grep -vE "newest|crates.io index" "${update_crates_output}" || true) | \
|
||||||
tr -s ' ' | \
|
tr -s ' ' | \
|
||||||
@ -91,11 +102,11 @@ jobs:
|
|||||||
sed "s/^=>/###/g" | \
|
sed "s/^=>/###/g" | \
|
||||||
sed "s/^ /- /g" > "${pr_comment_file}"
|
sed "s/^ /- /g" > "${pr_comment_file}"
|
||||||
pr_comment="$(cat "${pr_comment_file}")"
|
pr_comment="$(cat "${pr_comment_file}")"
|
||||||
gh pr create --title "ˉᵇᵒᵗˉUpdate crates" --base master --head "${BOT_UPDATE_BRANCHE_NAME}" --body "${pr_comment}" && gh_exit_code=0 || gh_exit_code=$?
|
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
|
||||||
|
gh pr comment "${NEW_PR_NUMBER}" --body "${pr_comment}" && gh_exit_code=0 || gh_exit_code=$?
|
||||||
if [ ${gh_exit_code} -eq 0 ] ; then
|
if [ ${gh_exit_code} -eq 0 ] ; then
|
||||||
NEW_PR_NUMBER=$(gh pr list --repo "${REPO}" --head "${BOT_UPDATE_BRANCHE_NAME}" --state "open" --json number --jq .[].number)
|
echo " - ✅ Comment updates list to pull request succeeds."
|
||||||
echo " - ✅ Creation of pull request n°${NEW_PR_NUMBER} succeeds."
|
|
||||||
else
|
else
|
||||||
echo " - ❌ A problem occurs when attempting to create new PR."
|
echo " - ❌ A problem occurs when attempting to create updates list comment in new pull request n°${NEW_PR_NUMBER}."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user