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 documentation shows old checkout-version #704

Closed
nils-a opened this issue Oct 5, 2020 · 9 comments · Fixed by #743
Closed

GitHub Actions documentation shows old checkout-version #704

nils-a opened this issue Oct 5, 2020 · 9 comments · Fixed by #743
Assignees
Milestone

Comments

@nils-a
Copy link
Contributor

nils-a commented Oct 5, 2020

as discussed the current documentation at https://cake-contrib.github.io/Cake.Recipe/docs/ci-systems/github lists

      - uses: actions/checkout@v2.2.0
        with:
          fetch-depth: 0

while f385c90 shows:

     - name: Checkout the requested branch
        uses: actions/checkout@v2.3.1
      - name: Fetch all tags and branches
        run: git fetch --prune --unshallow

We need to get these either sorted (why do we use two different ways of doing stuff) or documented. Probably first sorted, then documented.

@AdmiringWorm
Copy link
Member

TBH, we need to figure out which one of these works the best.
I originally used the first version, but was recommended by 1 of the GitTools members in a previous Gary stream to use the second one (I think it was because just using fetch-depth wouldn't pull down all the tags and branches, but I could be wrong there).

But I haven't really found either one of them to work as it should on GitHub actions (for tag builds) due to it always creating a merge commit when checking out the action (I think that is the reason, can't remember exactly).

@AdmiringWorm AdmiringWorm added this to the vNext milestone Oct 5, 2020
@nils-a
Copy link
Contributor Author

nils-a commented Oct 5, 2020

the docs for actions/checkout state

Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set fetch-depth: 0 to fetch all history for all branches and tags. Refer here to learn which commit $GITHUB_SHA points to for different events.

not sure about the tags, though.

@AdmiringWorm
Copy link
Member

it fetches all of the history, but I found that it didn't necessarily fetch all of the branch/tag names.
Again, this is assuming I remember correctly.

@nils-a
Copy link
Contributor Author

nils-a commented Oct 7, 2020

@AdmiringWorm in some files (I think yours, too) I also found:

    with:
          ref: ${{ github.event.ref }}

which I copied into some of my files.

Now, looking at https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows I feel like that's not needed. Any ideas why the ref would be given this way?

Also, from my understanding, on a clean checkout when the next command is git fetch --prune --unshallow there shouldn't be anything to prune or am I missing something?

@AdmiringWorm
Copy link
Member

@AdmiringWorm in some files (I think yours, too) I also found:

    with:
          ref: ${{ github.event.ref }}

which I copied into some of my files.

Now, looking at docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows I feel like that's not needed. Any ideas why the ref would be given this way?

In general, you do not need it.
Not completely sure why I added that in one of my repos, but I think it was for trying to get GitVersion to play nicely, or it was because of the way I initiated the workflow and without it the checkout action wouldn't check out the correct reference.

Also, from my understanding, on a clean checkout when the next command is git fetch --prune --unshallow there shouldn't be anything to prune or am I missing something?

if setting fetch-depth then that is correct, you actually can't use git fetch --prune --unshallow at all then.
1 or the other needs to be used, but both can't be used in the same workflow.

@nils-a
Copy link
Contributor Author

nils-a commented Jan 5, 2021

@AdmiringWorm going over the code in github.md, the sample also contains the following step:

      - name: Setup .NET Core 3.1
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 3.1.107

I feel that's not really needed. (That is to say: I don't have it any of my builds...)

EDIT:
The example shown in travisci.md also shows installation of a .NET Core sdk (though a different version)

nils-a added a commit to nils-a/Cake.Recipe that referenced this issue Jan 5, 2021
to the list of steps and explained why that is needed.
nils-a added a commit to nils-a/Cake.Recipe that referenced this issue Jan 5, 2021
to the list of steps and explained why that is needed.
@AdmiringWorm
Copy link
Member

You are right, it isn't necessary in the GitHub actions anymore (it used to be required).
Now it is only necessary if the build image does not contain the .NET core version you want.

I don't know about travis though, while it needs to install .NET Core, I am not sure why it is done through chocolatey (as usually I have done it through the dotnet variable). Could be that that doesn't work on the windows image 😕.

@nils-a
Copy link
Contributor Author

nils-a commented Jan 5, 2021

I created #742 to check the travis-ci page.

@gep13 gep13 closed this as completed in #743 Jan 8, 2021
gep13 added a commit that referenced this issue Jan 8, 2021
Updated the GitHub-Actions ci-page
@gep13 gep13 modified the milestones: vNext, 2.2.0 Jan 8, 2021
cake-contrib-bot pushed a commit that referenced this issue Jan 8, 2021
Merge pull request #743 from nils-a/feature/GH-704

Updated the GitHub-Actions ci-page
@cake-contrib-bot
Copy link
Contributor

🎉 This issue has been resolved in version 2.2.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants