mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-04-22 01:22:02 +03:00
Replace deprecated String.prototype.substr()
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated. Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
parent
2d1c1198e7
commit
dedef103f1
4 changed files with 13 additions and 13 deletions
|
@ -64,11 +64,11 @@ export async function prepareExistingDirectory(
|
|||
if (ref) {
|
||||
ref = ref.startsWith('refs/') ? ref : `refs/heads/${ref}`
|
||||
if (ref.startsWith('refs/heads/')) {
|
||||
const upperName1 = ref.toUpperCase().substr('REFS/HEADS/'.length)
|
||||
const upperName1 = ref.toUpperCase().slice('REFS/HEADS/'.length)
|
||||
const upperName1Slash = `${upperName1}/`
|
||||
branches = await git.branchList(true)
|
||||
for (const branch of branches) {
|
||||
const upperName2 = branch.substr('origin/'.length).toUpperCase()
|
||||
const upperName2 = branch.slice('origin/'.length).toUpperCase()
|
||||
const upperName2Slash = `${upperName2}/`
|
||||
if (
|
||||
upperName1.startsWith(upperName2Slash) ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue