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

Error when setting action version via SHA #67

Closed
vorburger opened this issue Nov 2, 2023 · 4 comments · Fixed by #72
Closed

Error when setting action version via SHA #67

vorburger opened this issue Nov 2, 2023 · 4 comments · Fixed by #72
Labels
bug Something isn't working

Comments

@vorburger
Copy link
Contributor

In https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20 I ran into this:

Run rossjrw/pr-preview-action@183082fd714654433c8e2f6daedbfb4f20f2a94a
  with:
    source-dir: BUILT/site/
    deploy-repository: www-learn-study/previews
    preview-branch: gh-pages
    umbrella-dir: pr-preview
    action: auto
Run echo "action=$action" >> $GITHUB_ENV
  echo "action=$action" >> $GITHUB_ENV
  echo "targetdir=$umbrella/pr-$pr" >> $GITHUB_ENV
  echo "pr=$pr" >> $GITHUB_ENV
  
  org=$(echo "$deployrepo" | cut -d "/" -f 1)
  thirdleveldomain=$(echo "$deployrepo" | cut -d "/" -f [2](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:2))
  
  if [ ! -z "$customurl" ]; then
    pagesurl="$customurl"
  elif [ "${org}.github.io" == "$thirdleveldomain" ]; then
    pagesurl="${org}.github.io"
  else
    pagesurl=$(echo "$deployrepo" | sed 's/\//.github.io\//')
  fi
  
  echo "pagesurl=$pagesurl" >> $GITHUB_ENV
  
  echo "emptydir=$(mktemp -d)" >> $GITHUB_ENV
  echo "datetime=$(date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV
  
  echo "actionref=$actionref" >> $GITHUB_ENV
  echo "actionrepo=$actionrepo" >> $GITHUB_ENV
  echo "deployrepo=$deployrepo" >> $GITHUB_ENV
  echo "token=$token" >> $GITHUB_ENV
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    action: auto
    umbrella: pr-preview
    pr: 20
    actionref: 18[3](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:3)082fd71[4](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:4)6[5](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:5)4433c8e2f[6](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:6)daedbfb4f20f2a94a
    actionrepo: rossjrw/pr-preview-action
    customurl: 
    deployrepo: www-learn-study/previews
    token: 
Run action_version=$("$GITHUB_ACTION_PATH/lib/find-current-git-tag.sh" -p $actionrepo -f $actionref)
  action_version=$("$GITHUB_ACTION_PATH/lib/find-current-git-tag.sh" -p $actionrepo -f $actionref)
  echo "action_version=$action_version" >> "$GITHUB_ENV"
  shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  env:
    action: auto
    targetdir: pr-preview/pr-20
    pr: 20
    pagesurl: www-learn-study.github.io/previews
    emptydir: /tmp/tmp.bCj8nD[7](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:7)DOE
    datetime: 2023-11-02 06:39 UTC
    actionref: 1[8](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:9)3082fd714654433c8e2f6daedbfb4f20f2a[9](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:10)4a
    actionrepo: rossjrw/pr-preview-action
    deployrepo: www-learn-study/previews
    token: 
Determining Git tag for rossjrw/pr-preview-action/183082fd7[14](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:15)654433c8e2f6daedbfb4f20f2a94a
Cloning repository rossjrw/pr-preview-action at ref [18](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:19)3082fd714654433c8e2f6daedbfb4f[20](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:21)f2a94a
Cloning into bare repository 'bare_pr_preview'...
warning: Could not find remote branch 183082fd714654433c8e2f6daedbfb4f20f2a94a to clone.
fatal: Remote branch 183082fd714654433c8e2f6daedbfb4f20f2a94a not found in upstream origin
/home/runner/work/_actions/rossjrw/pr-preview-action/183082fd714654433c8e2f6daedbfb4f20f2a94a/lib/find-current-git-tag.sh: line [29](https://github.com/www-learn-study/saraswati.learn.study/actions/runs/6729181929/job/18289629833?pr=20#step:5:30): cd: bare_pr_preview: No such file or directory
Error: Process completed with exit code 1.
@vorburger
Copy link
Contributor Author

vorburger commented Nov 2, 2023

Is this possibly caused by aa0f798 & Co?

Why does your action have fancy code to find its own revision? That's curious / interesting - doesn't GitHub check-out the actions?

Or is this not failing to clone the action, but the repo? The "source" or the "target" deploy-repository one?

vorburger added a commit to www-learn-study/saraswati.learn.study that referenced this issue Nov 2, 2023
Was this change I made in 8e058c4 the culprit causing rossjrw/pr-preview-action#67?!

Signed-off-by: Michael Vorburger <[email protected]>
@vorburger
Copy link
Contributor Author

Apparently the change I made in www-learn-study/saraswati.learn.study@8e058c4 was the culprit causing this?!

Reverting that in www-learn-study/saraswati.learn.study#55 seems to do the trick (but makes www-learn-study/saraswati.learn.study#50 re-appear, but that's another story).

That using a verion tag instead of a SHA fixes this seems really weird, to me... no action should prevent me from using a SHA (which is considered more secure) instead of a Tag!

@rossjrw
Copy link
Owner

rossjrw commented Nov 2, 2023

Why does your action have fancy code to find its own revision? That's curious / interesting - doesn't GitHub check-out the actions?

It's to display the specific action version in the message with the preview link. E.g. if you use rossjrw/pr-preview-action@v1, I feel that it's more useful for the message to show 'v1.2.1' or whatever instead of just 'v1'.

no action should prevent me from using a SHA (which is considered more secure) instead of a Tag!

You're right, and in fact, this was already fixed in #36. But since then, I've managed to accidentally remove that fallback in aa0f798. This one's on me.

@rossjrw rossjrw added the bug Something isn't working label Nov 2, 2023
@rossjrw rossjrw changed the title find-current-git-tag.sh: warning: Could not find remote branch ... to clone / fatal: Remote branch ... not found in upstream origin Error when setting action version via SHA Nov 3, 2023
@rossjrw
Copy link
Owner

rossjrw commented Dec 19, 2023

Fixed in v1.4.6

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

Successfully merging a pull request may close this issue.

2 participants