Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions: Replace master references with origin/HEAD #43942

Conversation

sarayourfriend
Copy link
Contributor

In many cases, origin just by itself is an alias for origin/HEAD.
When a specific branch name is needed, such as in the case of the
CI caches changed in this commit, we can use HEAD as a direct
alias for the primary branch, regardless of to what it is currently
set.

See set-head entry in git remote man page: https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-remote.html

Our repository is configured with HEAD -> master:

$ git branch -l -a | grep remotes/origin/HEAD
remotes/origin/HEAD -> origin/master

Changes proposed in this Pull Request

  • Update GitHub Action references to master branch with references to origin/HEAD or just origin or HEAD when appropriate

Testing instructions

  • Check that GitHub actions on this PR continue to work

Part of #43939

@sarayourfriend sarayourfriend requested a review from a team as a code owner July 7, 2020 13:47
@matticbot
Copy link
Contributor

@sarayourfriend sarayourfriend force-pushed the update/reference-origin-head-rather-than-branch-GitHubActions branch 2 times, most recently from f58cbea to b816c55 Compare July 7, 2020 14:22
@noahtallen
Copy link
Member

Wow, nice! Thank you for doing this. I didn't know this was a thing :)

To cause the FSE plugin tests to run, could you commit a small change to a file in apps/full-site-editing/full-site-editing-plugin/?

@sarayourfriend sarayourfriend force-pushed the update/reference-origin-head-rather-than-branch-GitHubActions branch from b57fb61 to 1278e05 Compare July 7, 2020 17:15
@sarayourfriend
Copy link
Contributor Author

sarayourfriend commented Jul 7, 2020

There's also this line in the ICFY action but it cannot be changed to use origin/HEAD: https://github.com/Automattic/wp-calypso/blob/95211b413b3b9c8cb61c2f94ecb80d62bffc6bfe/.github/workflows/icfy-stats.yml#L45

I suspect this is due to how the checkout action works which is that it inits an empty repository and then add the origin remote rather than just cloning the repository. I think this causes it to lose the mapping between HEAD -> master that exists normally.

From tmate action debugging session:

runner@fv-az32:~/work/wp-calypso/wp-calypso$ git merge-base HEAD remotes/origin/HEAD
fatal: Not a valid object name remotes/origin/HEAD
runner@fv-az32:~/work/wp-calypso/wp-calypso$ git branch -l -a | grep HEAD
runner@fv-az32:~/work/wp-calypso/wp-calypso$ git branch -l -a | grep master
  remotes/origin/master

This will just need to be changed when we actually rename the branch to trunk.

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

Caution: This PR affects files in the FSE Plugin on WordPress.com
Please ensure your changes work on WordPress.com before merging.

D46056-code has been created so you can easily test it on your sandbox. See this FieldGuide page about developing in the FSE Plugin for more info: PCYsg-ly5-p2

@sarayourfriend sarayourfriend added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 7, 2020
Copy link
Member

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes to the FSE plugin workflow look good to me! :shipit:

@sarayourfriend sarayourfriend force-pushed the update/reference-origin-head-rather-than-branch-GitHubActions branch from 95211b4 to 1278e05 Compare July 7, 2020 18:31
@sarayourfriend sarayourfriend merged commit 1e9adac into master Jul 7, 2020
@sarayourfriend sarayourfriend deleted the update/reference-origin-head-rather-than-branch-GitHubActions branch July 7, 2020 18:31
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 7, 2020
@sarayourfriend sarayourfriend mentioned this pull request Jul 8, 2020
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants