Apply suggestions from code review

Co-authored-by: Henry Mercer <henry.mercer@me.com>
This commit is contained in:
Nick Fyson 2023-12-13 12:47:00 +00:00 коммит произвёл GitHub
Родитель 7898bc2041
Коммит c757f9f6de
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 6 добавлений и 6 удалений

12
.github/workflows/pr-checks.yml поставляемый
Просмотреть файл

@ -117,7 +117,7 @@ jobs:
check-node-version:
if: ${{ github.event.pull_request }}
name: Check node version consistency
name: Check Action Node versions
runs-on: ubuntu-latest
timeout-minutes: 45
env:
@ -126,24 +126,24 @@ jobs:
steps:
- uses: actions/checkout@v4
- id: head-version
name: check HEAD node version
name: Verify all Actions use the same Node version
run: |
NODE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq)
echo "NODE_VERSION: ${NODE_VERSION}"
if [[ $(echo "$NODE_VERSION" | wc -l) -gt 1 ]]; then
echo "Error: More than one node version used in actions."
echo "::error::More than one node version used in 'action.yml' files."
exit 1
fi
echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT
- id: checkout-base
name: check out base ref for backport check
name: 'Backport: Check out base ref'
if: ${{ startsWith(github.head_ref, 'backport-') }}
uses: actions/checkout@v4
with:
ref: ${{ env.BASE_REF }}
- name: compare with node version on base ref for backport check
- name: 'Backport: Verify Node versions unchanged'
if: steps.checkout-base.outcome == 'success'
env:
HEAD_VERSION: ${{ steps.head-version.outputs.node_version }}
@ -152,6 +152,6 @@ jobs:
echo "HEAD_VERSION: ${HEAD_VERSION}"
echo "BASE_VERSION: ${BASE_VERSION}"
if [[ "$BASE_VERSION" != "$HEAD_VERSION" ]]; then
echo "Error: Cannot change node version in a backport PR."
echo "::error::Cannot change the Node version of an Action in a backport PR."
exit 1
fi