Experiment 1

You should set up the required code repositories in 13.2 Prepare Source Code if you have not done it yet.

In this section, you are going to first merge person a’s code changes into the main branch. Once that’s done, you create a pull request to integrate person b’s updates. This action trigger the CI workflow, and you might discover something interesting along the way. Let’s and explore!

1. Make sure you are still in the right project folder.

cd path/to/experiment-1

2. Switch to person-a branch.

git checkout person-a

3. Push your changes to the remote repository on the corresponding branch.

git push --set-upstream origin person-a

4. On your remote repository, click Compare & pull request.

0001

5. Click Create pull request.

0002

6. Wait for the job has passed and then click Merge pull request.

0003

7. Click Confirm merge.

0004

8. Click Delete branch.

0005

9. Click the Code tab and then open the main.py file.

0006

10. You might notice that the default value of n is now 7.

0007

11. On your local repository, switch to person-b branch.

git checkout person-b

12. Push your changes to the remote repository on the corresponding branch.

git push --set-upstream origin person-b

13. On your remote repository, click Compare & pull request.

0008

14. Click Create pull request.

0009

15. Boom! Your CI check has failed. Click Details to explore.

00010

16. Expand the Show main.py content step dropdown, and you might notice the default value of n is now 7. You should recall that person b did not modify this in his code changes (see step 16 in 13.2 Prepare Source Code).

00011

It turns out that GitHub Actions Checkout will retrieve the merged code between the pull request and the target (main) branch by default. Learn more about the issuse here.

This experiment shows that even if your code passes all local tests and shows no conflicts in the pull request, you could still face CI failures in the remote workflow. This happens because GitHub Actions Checkout for person b’s pull request integrates both b’s changes and the latest updates from the main branch, which includes changes from person a already.