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

Issue: act does not update actions if version is taken from branch #785

Closed
igagis opened this issue Aug 27, 2021 · 1 comment · Fixed by #791
Closed

Issue: act does not update actions if version is taken from branch #785

igagis opened this issue Aug 27, 2021 · 1 comment · Fixed by #791
Labels
kind/bug Something isn't working

Comments

@igagis
Copy link

igagis commented Aug 27, 2021

System information

- Operating System:  Linux
- Architecture: x86 (32-bit), arm (32-bit)
- Apple M1: no
- Docker version: 20.10.8
- Docker image used in `act`: `arm32v7/debian:buster`
- `act` version: ?

Expected behaviour

  1. refer to a custom action via branch name, e.g. master:
- uses: myci-actions/add-deb-repo@master
# ...
  1. run workflow
  2. update the action, so that master points to another commit
  3. run workflow

Result: on step 4 the updated action is used

Actual behaviour

on step 4 the old action is used. Repeating the workflow run makes it to use the proper updated action.

Workflow and/or repository

Log
⭐  Run ChristopherHX/ghat2/.github/comp1@issue-49
  ☁  git clone 'https://github.com/ChristopherHX/ghat2' # ref=issue-49
  cloning https://github.com/ChristopherHX/ghat2 to C:\Users\Christopher\.cache\act/ChristopherHX-ghat2-.github-comp1@issue-49
Provided ref is not a sha. Checking out branch before pulling changes
Unable to pull refs/heads/issue-49: non-fast-forward update
Cloned https://github.com/ChristopherHX/ghat2 to C:\Users\Christopher\.cache\act/ChristopherHX-ghat2-.github-comp1@issue-49
Checked out issue-49
open C:\Users\Christopher\.cache\act\ChristopherHX-ghat2-.github-comp1@issue-49\.github\comp1\action.yaml: Das System kann den angegebenen Pfad nicht finden.
open C:\Users\Christopher\.cache\act\ChristopherHX-ghat2-.github-comp1@issue-49\.github\comp1\action.yaml: Das System kann den angegebenen Pfad nicht finden.
  ❌  Failure - ChristopherHX/ghat2/.github/comp1@issue-49

info

I faced this issue in context of github actions runner based on act, see corresponding issue there: ChristopherHX/github-act-runner#49

@igagis igagis added the kind/bug Something isn't working label Aug 27, 2021
@ChristopherHX
Copy link
Contributor

After looking more in the src of act...
The new branch ref is fetched, but refs/heads/<branchname> still points to the last pulled branch revision.

if hash, err = r.ResolveRevision(rev); err != nil {

Then pull failes, which seem to be ok. (or it actually doesn't failed due to force?)
Now this function does a checkout to the previous commit sha which is not uptodate after the branch pull.

act/pkg/common/git.go

Lines 377 to 395 in de44a50

logger.Debugf("Cloned %s to %s", input.URL, input.Dir)
if err = w.Checkout(&git.CheckoutOptions{
Hash: *hash,
Force: true,
}); err != nil {
logger.Errorf("Unable to checkout %s: %v", *hash, err)
return err
}
if err = w.Reset(&git.ResetOptions{
Mode: git.HardReset,
Commit: *hash,
}); err != nil {
logger.Errorf("Unable to reset to %s: %v", hash.String(), err)
return err
}
logger.Debugf("Checked out %s", input.Ref)

calling the function again corrects this if the branch hasn't changed between the two calls. Better log the commit hash as it is the wrong one in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants