Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is it possible to get information from the new feature "changesets"?

Denis Di Fazio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 14, 2020

I wonder if it is possible to echo what were the modified paths between two pull requests using the new feature "changesets"

 

I have something like that in mind:

 - step:
          name: step1
          condition:
              changesets:
                 - echo changesets

 

1 answer

1 accepted

0 votes
Answer accepted
ktomk
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 8, 2020

Yes, the information is available by the version control system which is accessible by the git utility. As long as you have it in your build container.

The includePaths directive checks for modified paths.

You can obtain the information by listing modified files between HEAD and the appropriate ancestor which is different depending on the type of the pipeline:

In a pull-request pipeline, all commits are taken into account, and if you provide an includePath list of patterns, a step will be executed when at least one commit change matches one of the conditions.

and:

For other types of pipelines, only the last commit is considered.

To show all changed files for the last commit:

git diff --name-only

For the pull request pipeline I don't have one at hand to verify it, the "Build setup" in such a Pipeline should show whether or not the merge is already committed, if so it could be the same or you can diff to the merge base:

git diff --name-only $(git merge-base "${BITBUCKET_PR_DESTINATION_BRANCH}" HEAD)

Use the `--diff-filter` switch to fine-tune which paths are displayed, `--name-status` to show the status of each path and mind path quoting (use `-z` for null-byte separated paths).

Reference:

Denis Di Fazio
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 22, 2020

Awesome, thank you for the explanation!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events