|
45 | 45 | uses: actions/checkout@v4
|
46 | 46 |
|
47 | 47 | - name: Set up Python
|
48 |
| - uses: actions/setup-python@v4 |
| 48 | + uses: actions/setup-python@v5 |
49 | 49 | with:
|
50 | 50 | python-version: 3.11
|
51 | 51 |
|
|
70 | 70 |
|
71 | 71 | steps:
|
72 | 72 | - name: Setup Python on MacOS
|
73 |
| - uses: actions/setup-python@v4 |
| 73 | + uses: actions/setup-python@v5 |
74 | 74 | if: |
|
75 | 75 | matrix.os == 'macos-latest' && (
|
76 | 76 | matrix.version == 'stable-20220908' ||
|
|
88 | 88 | # we won't be able to find them on Windows.
|
89 | 89 | npm config set script-shell bash
|
90 | 90 | npm test
|
| 91 | +
|
| 92 | + check-node-version: |
| 93 | + if: ${{ github.event.pull_request }} |
| 94 | + name: Check Action Node versions |
| 95 | + runs-on: ubuntu-latest |
| 96 | + timeout-minutes: 45 |
| 97 | + env: |
| 98 | + BASE_REF: ${{ github.base_ref }} |
| 99 | + |
| 100 | + steps: |
| 101 | + - uses: actions/checkout@v4 |
| 102 | + - id: head-version |
| 103 | + name: Verify all Actions use the same Node version |
| 104 | + run: | |
| 105 | + NODE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq) |
| 106 | + echo "NODE_VERSION: ${NODE_VERSION}" |
| 107 | + if [[ $(echo "$NODE_VERSION" | wc -l) -gt 1 ]]; then |
| 108 | + echo "::error::More than one node version used in 'action.yml' files." |
| 109 | + exit 1 |
| 110 | + fi |
| 111 | + echo "node_version=${NODE_VERSION}" >> $GITHUB_OUTPUT |
| 112 | +
|
| 113 | + - id: checkout-base |
| 114 | + name: 'Backport: Check out base ref' |
| 115 | + if: ${{ startsWith(github.head_ref, 'backport-') }} |
| 116 | + uses: actions/checkout@v4 |
| 117 | + with: |
| 118 | + ref: ${{ env.BASE_REF }} |
| 119 | + |
| 120 | + - name: 'Backport: Verify Node versions unchanged' |
| 121 | + if: steps.checkout-base.outcome == 'success' |
| 122 | + env: |
| 123 | + HEAD_VERSION: ${{ steps.head-version.outputs.node_version }} |
| 124 | + run: | |
| 125 | + BASE_VERSION=$(find . -name "action.yml" -exec yq -e '.runs.using' {} \; | grep node | sort | uniq) |
| 126 | + echo "HEAD_VERSION: ${HEAD_VERSION}" |
| 127 | + echo "BASE_VERSION: ${BASE_VERSION}" |
| 128 | + if [[ "$BASE_VERSION" != "$HEAD_VERSION" ]]; then |
| 129 | + echo "::error::Cannot change the Node version of an Action in a backport PR." |
| 130 | + exit 1 |
| 131 | + fi |
0 commit comments