Unexpected commit reported in Slack message

I’ve got a pipeline that does something along these lines:

  • check out the project (Project #1) from git (stash currently, soon to be github)
    • using git-clone@6 step
  • trigger specific workflow
    • using bitrise-run@0.9 step
  • check out an extra project (Project #2) from git (some useful CI scripts for this specific workflow)
    • using git-clone@6 step
  • do some things
  • report status to Slack
    • using slack step

In the slack message it reports the last commit from Project #2, which is of less interest to me and I expected/desired Project #1’s commit to be reported.

Is there any way to avoid this behaviour, or does it always just take the commit message from the last git project cloned?

The git-clone step sets the environment variable GIT_CLONE_COMMIT_MESSAGE_SUBJECT as an output and the Slack Step uses the same variable as its input.
I suppose when you run the git-clone twice, the second run overwrites the environment variable. You could either change the order of the steps, or you could export the original environment variable to a different one, and then use the other one with the Slack step.
In the example below, I am using the “Set environment variable” step to export the contents of GIT_CLONE_COMMIT_MESSAGE_SUBJECT to a GIT_CLONE_COMMIT_MESSAGE_SUBJECT_FOR_SLACK:

Then I use it with the Slack step:

Note there are other variables you may need to export, such as the author name, or commit message body.

Thanks for this, seems like it should work taking this approach, though I’ve not yet had a chance to play with it!