The code pops the first element of an array in each execution and the length of the array is reduced by one each time when the webhook is triggered since the array is passed by reference in the code.
For example, consider the config shown as following:
When the webhook is triggered for the first time, foo bar baz is executed. For the second time, the command will be bar baz, and baz for the third time, and then an error is thrown for the fourth time since the array is empty and nothing can be popped.
The simplest solution might be copying the array instead of passing by reference.
The code pops the first element of an array in each execution and the length of the array is reduced by one each time when the webhook is triggered since the array is passed by reference in the code.
For example, consider the config shown as following:
When the webhook is triggered for the first time,
foo bar baz
is executed. For the second time, the command will bebar baz
, andbaz
for the third time, and then an error is thrown for the fourth time since the array is empty and nothing can be popped.The simplest solution might be copying the array instead of passing by reference.