How to check a build has passed after a pipeline pushes back to the repository?

José Luis Gallego Peña
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!
February 13, 2024

Hello, I am currently making a pipeline that runs RectorPHP on my code, makes the necessary fixes by itself and commits those changes back to the repository.

I have configured a merge check on my pull requests that the build must pass, and when I push back to my repostory, I commit with [skip-ci] so the pipeline doesn't loop again and again. Because of this, the last commit on the branch doesn't run the pipeline, so no builds are run and my merge condition of "1+ build passed" is of course unchecked.

The build has passed before, but it isn't reflected on the pull request because of that last commit. What would be the best way to approach this if I want that merge check to reflect that Rector has run successfully and I am able to merge? Thanks for your time

definitions:
caches:
rector-cache:
key:
files:
- "composer.lock"
path: ./var/cache/rector

pipelines:
pull-requests:
'**':
- step:
name: Install composer dependencies
script:
- composer install --no-progress --ansi
caches:
- composer
artifacts:
- build/**
- vendor/**
- composer.json
- composer
- step:
name: Rector and ECS
script:
- composer fix-rector
- composer fix-cs
- git config --global --add safe.directory /opt/atlassian/pipelines/agent/build
- if test -n "$(git diff)"; then git add . && git commit -m "[skip ci] Rector and ECS fixes" && git push; fi
caches:
- composer
- rector-cache

1 answer

2 votes
Saxea _Flowie_
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.
February 13, 2024

Hi @José Luis Gallego Peña

Maybe you could try to do this using the REST API to update the status for the last commit at the end? You'd also need to cater for build failure.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events