Skip to content

Commit 76ac16c

Browse files
authored
Add ticket-id-complement input (#31)
* add ticket-id-complement input to avoid indentical ticket_id value for parallel/matrix jobs in the same workflow run * adjust parameter naming
1 parent d3d5b35 commit 76ac16c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ inputs:
2929
description: '[Internal] The location to store the mutex repo'
3030
required: false
3131
default: '/run/gh-action-mutex/repo'
32+
ticket-id-suffix:
33+
description: 'Ticket id suffix to avoid identical values for parallel/matrix jobs in the same workflow run'
34+
required: false
35+
default: 'default'
3236
runs:
3337
using: 'docker'
3438
image: 'Dockerfile'
@@ -39,6 +43,7 @@ runs:
3943
ARG_REPOSITORY: ${{ inputs.repository }}
4044
ARG_REPO_TOKEN: ${{ inputs.repo-token }}
4145
ARG_DEBUG: ${{ inputs.debug }}
46+
ARG_TICKET_ID_SUFFIX: ${{ inputs.ticket-id-suffix}}
4247
entrypoint: '/scripts/lock.sh'
4348
post-entrypoint: '/scripts/unlock.sh'
4449

rootfs/scripts/lock.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ cd "$ARG_CHECKOUT_LOCATION"
1515

1616
__mutex_queue_file=mutex_queue
1717
__repo_url="https://x-access-token:$ARG_REPO_TOKEN@$ARG_GITHUB_SERVER/$ARG_REPOSITORY"
18-
__ticket_id="$GITHUB_RUN_ID-$(date +%s)-$(( $RANDOM % 1000 ))"
18+
__ticket_id="$GITHUB_RUN_ID-$(date +%s)-$(( $RANDOM % 1000 ))-$ARG_TICKET_ID_SUFFIX"
1919
echo "ticket_id=$__ticket_id" >> $GITHUB_STATE
2020

2121
set_up_repo "$__repo_url"

0 commit comments

Comments
 (0)