Skip to content

Commit e0b0ba3

Browse files
authored
chore(scripts): catch up on deprecated github actions (#1345)
1 parent d7b03ae commit e0b0ba3

File tree

12 files changed

+69
-41
lines changed

12 files changed

+69
-41
lines changed

.github/actions/setup/action.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ inputs:
66
type:
77
description: Type of setup, `minimal` will only setup the JavaScript monorepo, `matrix` will set the run variables.
88
required: false
9-
workflow_name:
10-
description: Name of the workflow that is executing this action.
11-
required: false
129
language:
1310
description: the language for which to install deps
1411
required: false
@@ -24,7 +21,7 @@ runs:
2421
# Java for code generation
2522
- name: Install Java
2623
if: inputs.type != 'minimal'
27-
uses: actions/setup-java@v2
24+
uses: actions/setup-java@v3
2825
with:
2926
distribution: zulu
3027
java-version: 11.0.4
@@ -41,15 +38,15 @@ runs:
4138

4239
# JavaScript for monorepo and tooling
4340
- name: Install Node
44-
uses: actions/setup-node@v2
41+
uses: actions/setup-node@v3
4542
with:
4643
node-version-file: .nvmrc
4744
cache: yarn
4845

4946
- name: Get yarn cache directory path
5047
shell: bash
5148
id: yarn-cache-dir
52-
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
49+
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
5350

5451
- name: Restore Yarn
5552
uses: actions/cache@v3
@@ -73,7 +70,7 @@ runs:
7370
if: ${{ inputs.language == 'javascript' }}
7471
shell: bash
7572
id: yarn-cache-dir-client
76-
run: echo "::set-output name=dir::$(cd clients/algoliasearch-client-javascript && yarn config get cacheFolder)"
73+
run: echo "dir=$(cd clients/algoliasearch-client-javascript && yarn config get cacheFolder)" >> $GITHUB_OUTPUT
7774

7875
- name: Restore Yarn js-client
7976
if: ${{ inputs.language == 'javascript' }}
@@ -134,7 +131,7 @@ runs:
134131
run: |
135132
if ${{ steps.gen-matrix.outputs.RUN_GEN_JAVASCRIPT || steps.diff.outputs.JAVASCRIPT_UTILS_CHANGED > 0 }}; then
136133
echo "Running JavaScript utils: true"
137-
echo "::set-output name=RUN_JS_UTILS::true"
134+
echo "RUN_JS_UTILS=true" >> $GITHUB_OUTPUT
138135
fi
139136
140137
outputs:

.github/workflows/check.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
GITHUB_CONTEXT: ${{ toJSON(github) }}
2626
run: echo "$GITHUB_CONTEXT"
2727

28-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v3
2929
with:
3030
fetch-depth: 0
3131

@@ -76,7 +76,7 @@ jobs:
7676
needs: setup
7777
if: ${{ needs.setup.outputs.RUN_SCRIPTS == 'true' }}
7878
steps:
79-
- uses: actions/checkout@v2
79+
- uses: actions/checkout@v3
8080

8181
- name: Setup
8282
uses: ./.github/actions/setup
@@ -97,7 +97,7 @@ jobs:
9797
timeout-minutes: 10
9898
needs: setup
9999
steps:
100-
- uses: actions/checkout@v2
100+
- uses: actions/checkout@v3
101101

102102
- name: Cache bundled specs
103103
id: cache
@@ -136,7 +136,7 @@ jobs:
136136
- requester-node-http
137137
- requester-fetch
138138
steps:
139-
- uses: actions/checkout@v2
139+
- uses: actions/checkout@v3
140140

141141
- name: Cache '${{ matrix.client }}' client folder
142142
id: cache
@@ -184,7 +184,7 @@ jobs:
184184
strategy:
185185
matrix: ${{ fromJSON(needs.setup.outputs.GEN_MATRIX) }}
186186
steps:
187-
- uses: actions/checkout@v2
187+
- uses: actions/checkout@v3
188188

189189
- name: Cache clients folder
190190
id: cache
@@ -247,7 +247,7 @@ jobs:
247247
if: ${{ matrix.client.language == 'javascript' }}
248248
shell: bash
249249
id: yarn-cache-dir-tests
250-
run: echo "::set-output name=dir::$(cd ${{ matrix.client.testsRootFolder }} && yarn config get cacheFolder)"
250+
run: echo "dir=$(cd ${{ matrix.client.testsRootFolder }} && yarn config get cacheFolder)" >> $GITHUB_OUTPUT
251251

252252
- name: Restore Yarn js tests
253253
if: ${{ matrix.client.language == 'javascript' }}
@@ -288,7 +288,7 @@ jobs:
288288
!contains(needs.*.result, 'cancelled') &&
289289
!contains(needs.*.result, 'failure')
290290
steps:
291-
- uses: actions/checkout@v2
291+
- uses: actions/checkout@v3
292292
with:
293293
fetch-depth: 0
294294
ref: ${{ github.event.pull_request.head.ref }}

.github/workflows/codegen.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
timeout-minutes: 10
1111
if: (github.event.action == 'opened' || github.event.action == 'synchronize') && github.event.number
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
with:
1515
fetch-depth: 0
1616
ref: ${{ github.event.pull_request.head.ref }}
@@ -32,7 +32,7 @@ jobs:
3232
timeout-minutes: 10
3333
if: github.event.action == 'closed'
3434
steps:
35-
- uses: actions/checkout@v2
35+
- uses: actions/checkout@v3
3636
with:
3737
fetch-depth: 0
3838
ref: main

.github/workflows/pr-title.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
runs-on: ubuntu-20.04
1010
timeout-minutes: 10
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v3
1313
with:
1414
fetch-depth: 0
1515

1616
- name: Pull Request title rules
17-
uses: deepakputhraya/action-pr-title@v1.0.2
17+
uses: Slashgear/action-check-pr-title@v4.3.0
1818
with:
19-
regex: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|javascript|php|java|cts|specs|scripts|ci|templates|deps)\)): .+'
19+
regexp: '^(docs|chore)|((?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)\((?:clients|generators|javascript|php|java|cts|specs|scripts|ci|templates|deps)\)): .+'

.github/workflows/scheduled-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: Scheduled Release
1515
runs-on: ubuntu-20.04
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
with:
1919
fetch-depth: 0
2020
ref: main

clients/algoliasearch-client-java-2/.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_PRIVATE_KEY_ID }}
1818
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PRIVATE_KEY_PASSWORD }}
1919
steps:
20-
- uses: actions/checkout@v2
20+
- uses: actions/checkout@v3
2121

2222
- name: Install Java
23-
uses: actions/setup-java@v2
23+
uses: actions/setup-java@v3
2424
with:
2525
distribution: zulu
2626
java-version: 11.0.4
@@ -36,7 +36,7 @@ jobs:
3636
id: snapshot
3737
run: |
3838
if [[ $(cat ./gradle.properties | grep 'VERSION_NAME=.*-SNAPSHOT') ]]; then
39-
echo "::set-output name=IS_SNAPSHOT::true"
39+
echo "IS_SNAPSHOT=true" >> $GITHUB_OUTPUT
4040
fi
4141
4242
- name: Release Artifacts

clients/algoliasearch-client-javascript/.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
runs-on: ubuntu-20.04
1212
if: "startsWith(github.event.head_commit.message, 'chore: release')"
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
with:
1616
fetch-depth: 0
1717

1818
- name: Install Node
19-
uses: actions/setup-node@v2
19+
uses: actions/setup-node@v3
2020
with:
2121
node-version-file: .nvmrc
2222
cache: yarn

scripts/ci/githubActions/createMatrix.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
/* eslint-disable no-console,no-case-declarations */
1+
/* eslint-disable no-case-declarations */
2+
import * as core from '@actions/core';
3+
24
import { CLIENTS, createClientName, GENERATORS, LANGUAGES } from '../../common';
35
import {
46
getClientsConfigField,
@@ -150,16 +152,15 @@ async function getClientMatrix(baseBranch: string): Promise<void> {
150152
testsToDelete,
151153
testsToStore,
152154
});
153-
console.log(`::set-output name=RUN_GEN_${language.toUpperCase()}::true`);
155+
core.setOutput(`RUN_GEN_${language.toUpperCase()}`, true);
154156
}
155157

156158
const shouldRun = clientMatrix.client.length > 0;
157159

158-
console.log(`::set-output name=RUN_GEN::${shouldRun}`);
159-
console.log(
160-
`::set-output name=GEN_MATRIX::${JSON.stringify(
161-
shouldRun ? clientMatrix : EMPTY_MATRIX
162-
)}`
160+
core.setOutput('RUN_GEN', shouldRun);
161+
core.setOutput(
162+
'GEN_MATRIX',
163+
JSON.stringify(shouldRun ? clientMatrix : EMPTY_MATRIX)
163164
);
164165
}
165166

@@ -187,7 +188,7 @@ async function getSpecMatrix(): Promise<void> {
187188
]),
188189
};
189190

190-
console.log(`::set-output name=MATRIX::${JSON.stringify(ciMatrix)}`);
191+
core.setOutput('MATRIX', JSON.stringify(ciMatrix));
191192
}
192193

193194
/**

scripts/ci/githubActions/setRunVariables.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/* eslint-disable no-console */
2+
import * as core from '@actions/core';
3+
24
import { CLIENTS_JS_UTILS } from '../../common';
35
import { getLanguageFolder } from '../../config';
46

@@ -81,7 +83,7 @@ async function setRunVariables({
8183
}): Promise<void> {
8284
console.log(`Checking diff between ${originBranch} and HEAD`);
8385

84-
console.log(`::set-output name=ORIGIN_BRANCH::${originBranch}`);
86+
core.setOutput('ORIGIN_BRANCH', originBranch);
8587

8688
await isBaseChanged(originBranch, DEPENDENCIES, true);
8789
}

scripts/ci/githubActions/utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* eslint-disable no-console */
22
import crypto from 'crypto';
33

4+
import * as core from '@actions/core';
45
import { hashElement } from 'folder-hash';
56

67
import { toAbsolutePath } from '../../common';
78
import { getNbGitDiff } from '../utils';
8-
99
/**
1010
* This cache key holds the hash of the common dependencies of all the clients.
1111
*/
@@ -63,22 +63,22 @@ export async function computeCacheKey(
6363
/**
6464
* Determines if changes have been found in the `dependencies`, compared to the `baseBranch`.
6565
*
66-
* If `setOutput` is true, it will set log the variable values for the CI.
66+
* If `output` is true, it will set log the variable values for the CI.
6767
*/
6868
export async function isBaseChanged(
6969
baseBranch: string,
7070
dependencies: Record<string, string[]>,
71-
setOutput?: boolean
71+
output?: boolean
7272
): Promise<boolean> {
7373
for (const [key, path] of Object.entries(dependencies)) {
7474
const diff = await getNbGitDiff({
7575
branch: baseBranch,
7676
path: path.join(' '),
7777
});
7878

79-
if (setOutput) {
79+
if (output) {
8080
console.log(`Found ${diff} changes for '${key}'`);
81-
console.log(`::set-output name=${key}::${diff}`);
81+
core.setOutput(key, diff);
8282
} else if (diff > 0) {
8383
return true;
8484
}

scripts/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"upsertGenerationComment": "ts-node ci/codegen/upsertGenerationComment.ts"
1414
},
1515
"devDependencies": {
16+
"@actions/core": "1.10.0",
1617
"@octokit/rest": "19.0.7",
1718
"@types/folder-hash": "4.0.2",
1819
"@types/inquirer": "8.2.6",

yarn.lock

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ __metadata:
55
version: 6
66
cacheKey: 8
77

8+
"@actions/core@npm:1.10.0":
9+
version: 1.10.0
10+
resolution: "@actions/core@npm:1.10.0"
11+
dependencies:
12+
"@actions/http-client": ^2.0.1
13+
uuid: ^8.3.2
14+
checksum: 0a75621e007ab20d887434cdd165f0b9036f14c22252a2faed33543d8b9d04ec95d823e69ca636a25245574e4585d73e1e9e47a845339553c664f9f2c9614669
15+
languageName: node
16+
linkType: hard
17+
18+
"@actions/http-client@npm:^2.0.1":
19+
version: 2.0.1
20+
resolution: "@actions/http-client@npm:2.0.1"
21+
dependencies:
22+
tunnel: ^0.0.6
23+
checksum: 799ec3df91e28a9da91ce6592e94f8b8923ccf6cc21a2f72c7429be5af5273f1625335411adc2a1bb222d56c852d5767214dfa6fa32a6da7e81dba8290e08f17
24+
languageName: node
25+
linkType: hard
26+
827
"@algolia/api-client-automation@workspace:.":
928
version: 0.0.0-use.local
1029
resolution: "@algolia/api-client-automation@workspace:."
@@ -7943,6 +7962,7 @@ __metadata:
79437962
version: 0.0.0-use.local
79447963
resolution: "scripts@workspace:scripts"
79457964
dependencies:
7965+
"@actions/core": 1.10.0
79467966
"@octokit/rest": 19.0.7
79477967
"@types/folder-hash": 4.0.2
79487968
"@types/inquirer": 8.2.6
@@ -8686,6 +8706,13 @@ __metadata:
86868706
languageName: node
86878707
linkType: hard
86888708

8709+
"tunnel@npm:^0.0.6":
8710+
version: 0.0.6
8711+
resolution: "tunnel@npm:0.0.6"
8712+
checksum: c362948df9ad34b649b5585e54ce2838fa583aa3037091aaed66793c65b423a264e5229f0d7e9a95513a795ac2bd4cb72cda7e89a74313f182c1e9ae0b0994fa
8713+
languageName: node
8714+
linkType: hard
8715+
86898716
"type-check@npm:^0.4.0, type-check@npm:~0.4.0":
86908717
version: 0.4.0
86918718
resolution: "type-check@npm:0.4.0"
@@ -8837,7 +8864,7 @@ __metadata:
88378864
languageName: node
88388865
linkType: hard
88398866

8840-
"uuid@npm:8.3.2":
8867+
"uuid@npm:8.3.2, uuid@npm:^8.3.2":
88418868
version: 8.3.2
88428869
resolution: "uuid@npm:8.3.2"
88438870
bin:

0 commit comments

Comments
 (0)