valentinegb / openai

An unofficial Rust library for the OpenAI API.
https://crates.io/crates/openai/
MIT License
61 stars 18 forks source link

Pull request Rust check uses wrong commit #53

Closed valentinegb closed 1 year ago

valentinegb commented 1 year ago

Bug Description

When the Rust workflow is triggered by a pull request, it checks out the last commit on the main branch instead of the last commit in the pull request / forked branch. The following code block is of the Run actions/checkout@v3 step from the Rust check on #50, as an example.

Terminal Output

2023-03-26T20:01:30.8912244Z ##[group]Run actions/checkout@v3
2023-03-26T20:01:30.8912552Z with:
2023-03-26T20:01:30.8912795Z   repository: valentinegb/openai
2023-03-26T20:01:30.8913221Z   token: ***
2023-03-26T20:01:30.8913433Z   ssh-strict: true
2023-03-26T20:01:30.8913651Z   persist-credentials: true
2023-03-26T20:01:30.8913876Z   clean: true
2023-03-26T20:01:30.8914078Z   fetch-depth: 1
2023-03-26T20:01:30.8914276Z   lfs: false
2023-03-26T20:01:30.8914458Z   submodules: false
2023-03-26T20:01:30.8914681Z   set-safe-directory: true
2023-03-26T20:01:30.8914899Z env:
2023-03-26T20:01:30.8915084Z   CARGO_TERM_COLOR: always
2023-03-26T20:01:30.8915450Z   OPENAI_KEY: ***
2023-03-26T20:01:30.8915660Z ##[endgroup]
2023-03-26T20:01:31.3029806Z Syncing repository: valentinegb/openai
2023-03-26T20:01:31.3032228Z ##[group]Getting Git version info
2023-03-26T20:01:31.3032907Z Working directory is '/home/runner/work/openai/openai'
2023-03-26T20:01:31.3054321Z [command]/usr/bin/git version
2023-03-26T20:01:31.3131653Z git version 2.40.0
2023-03-26T20:01:31.3246224Z ##[endgroup]
2023-03-26T20:01:31.3264186Z Temporarily overriding HOME='/home/runner/work/_temp/1452584f-27dd-44d3-8302-14ec8bc73ad9' before making global git config changes
2023-03-26T20:01:31.3264747Z Adding repository directory to the temporary git global config as a safe directory
2023-03-26T20:01:31.3265340Z [command]/usr/bin/git config --global --add safe.directory /home/runner/work/openai/openai
2023-03-26T20:01:31.3333231Z Deleting the contents of '/home/runner/work/openai/openai'
2023-03-26T20:01:31.3337016Z ##[group]Initializing the repository
2023-03-26T20:01:31.3339808Z [command]/usr/bin/git init /home/runner/work/openai/openai
2023-03-26T20:01:31.3411568Z hint: Using 'master' as the name for the initial branch. This default branch name
2023-03-26T20:01:31.3414301Z hint: is subject to change. To configure the initial branch name to use in all
2023-03-26T20:01:31.3417670Z hint: of your new repositories, which will suppress this warning, call:
2023-03-26T20:01:31.3418420Z hint: 
2023-03-26T20:01:31.3418855Z hint:  git config --global init.defaultBranch <name>
2023-03-26T20:01:31.3419123Z hint: 
2023-03-26T20:01:31.3419609Z hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
2023-03-26T20:01:31.3508556Z hint: 'development'. The just-created branch can be renamed via this command:
2023-03-26T20:01:31.3508923Z hint: 
2023-03-26T20:01:31.3509221Z hint:  git branch -m <name>
2023-03-26T20:01:31.3509680Z Initialized empty Git repository in /home/runner/work/openai/openai/.git/
2023-03-26T20:01:31.3510773Z [command]/usr/bin/git remote add origin https://github.com/valentinegb/openai
2023-03-26T20:01:31.3519639Z ##[endgroup]
2023-03-26T20:01:31.3520124Z ##[group]Disabling automatic garbage collection
2023-03-26T20:01:31.3522047Z [command]/usr/bin/git config --local gc.auto 0
2023-03-26T20:01:31.3558206Z ##[endgroup]
2023-03-26T20:01:31.3559093Z ##[group]Setting up auth
2023-03-26T20:01:31.3566159Z [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
2023-03-26T20:01:31.3604809Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
2023-03-26T20:01:31.4258738Z [command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/github\.com\/\.extraheader
2023-03-26T20:01:31.4260261Z [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/github\.com\/\.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
2023-03-26T20:01:31.4495613Z [command]/usr/bin/git config --local http.https://github.com/.extraheader AUTHORIZATION: basic ***
2023-03-26T20:01:31.4546984Z ##[endgroup]
2023-03-26T20:01:31.4547582Z ##[group]Fetching the repository
2023-03-26T20:01:31.4572295Z [command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +a9514d747bc67f416370d671c8db7ae5663ab3ea:refs/remotes/origin/main
2023-03-26T20:01:31.8514624Z remote: Enumerating objects: 38, done.        
2023-03-26T20:01:31.8515369Z remote: Counting objects:   2% (1/38)        
2023-03-26T20:01:31.8515905Z remote: Counting objects:   5% (2/38)        
2023-03-26T20:01:31.8516329Z remote: Counting objects:   7% (3/38)        
2023-03-26T20:01:31.8516743Z remote: Counting objects:  10% (4/38)        
2023-03-26T20:01:31.8517132Z remote: Counting objects:  13% (5/38)        
2023-03-26T20:01:31.8517652Z remote: Counting objects:  15% (6/38)        
2023-03-26T20:01:31.8518169Z remote: Counting objects:  18% (7/38)        
2023-03-26T20:01:31.8518543Z remote: Counting objects:  21% (8/38)        
2023-03-26T20:01:31.8518924Z remote: Counting objects:  23% (9/38)        
2023-03-26T20:01:31.8519307Z remote: Counting objects:  26% (10/38)        
2023-03-26T20:01:31.8519688Z remote: Counting objects:  28% (11/38)        
2023-03-26T20:01:31.8520084Z remote: Counting objects:  31% (12/38)        
2023-03-26T20:01:31.8520665Z remote: Counting objects:  34% (13/38)        
2023-03-26T20:01:31.8521096Z remote: Counting objects:  36% (14/38)        
2023-03-26T20:01:31.8521488Z remote: Counting objects:  39% (15/38)        
2023-03-26T20:01:31.8521993Z remote: Counting objects:  42% (16/38)        
2023-03-26T20:01:31.8522380Z remote: Counting objects:  44% (17/38)        
2023-03-26T20:01:31.8522767Z remote: Counting objects:  47% (18/38)        
2023-03-26T20:01:31.8523153Z remote: Counting objects:  50% (19/38)        
2023-03-26T20:01:31.8523535Z remote: Counting objects:  52% (20/38)        
2023-03-26T20:01:31.8523904Z remote: Counting objects:  55% (21/38)        
2023-03-26T20:01:31.8524291Z remote: Counting objects:  57% (22/38)        
2023-03-26T20:01:31.8524674Z remote: Counting objects:  60% (23/38)        
2023-03-26T20:01:31.8525180Z remote: Counting objects:  63% (24/38)        
2023-03-26T20:01:31.8525551Z remote: Counting objects:  65% (25/38)        
2023-03-26T20:01:31.8526588Z remote: Counting objects:  68% (26/38)        
2023-03-26T20:01:31.8527014Z remote: Counting objects:  71% (27/38)        
2023-03-26T20:01:31.8527395Z remote: Counting objects:  73% (28/38)        
2023-03-26T20:01:31.8527888Z remote: Counting objects:  76% (29/38)        
2023-03-26T20:01:31.8528315Z remote: Counting objects:  78% (30/38)        
2023-03-26T20:01:31.8528690Z remote: Counting objects:  81% (31/38)        
2023-03-26T20:01:31.8529199Z remote: Counting objects:  84% (32/38)        
2023-03-26T20:01:31.8529557Z remote: Counting objects:  86% (33/38)        
2023-03-26T20:01:31.8529928Z remote: Counting objects:  89% (34/38)        
2023-03-26T20:01:31.8530302Z remote: Counting objects:  92% (35/38)        
2023-03-26T20:01:31.8530667Z remote: Counting objects:  94% (36/38)        
2023-03-26T20:01:31.8531033Z remote: Counting objects:  97% (37/38)        
2023-03-26T20:01:31.8531416Z remote: Counting objects: 100% (38/38)        
2023-03-26T20:01:31.8531807Z remote: Counting objects: 100% (38/38), done.        
2023-03-26T20:01:31.8532226Z remote: Compressing objects:   3% (1/32)        
2023-03-26T20:01:31.8532632Z remote: Compressing objects:   6% (2/32)        
2023-03-26T20:01:31.8533147Z remote: Compressing objects:   9% (3/32)        
2023-03-26T20:01:31.8533524Z remote: Compressing objects:  12% (4/32)        
2023-03-26T20:01:31.8539024Z remote: Compressing objects:  15% (5/32)        
2023-03-26T20:01:31.8571036Z remote: Compressing objects:  18% (6/32)        
2023-03-26T20:01:31.8574281Z remote: Compressing objects:  21% (7/32)        
2023-03-26T20:01:31.8575565Z remote: Compressing objects:  25% (8/32)        
2023-03-26T20:01:31.8576943Z remote: Compressing objects:  28% (9/32)        
2023-03-26T20:01:31.8578232Z remote: Compressing objects:  31% (10/32)        
2023-03-26T20:01:31.8579413Z remote: Compressing objects:  34% (11/32)        
2023-03-26T20:01:31.8580912Z remote: Compressing objects:  37% (12/32)        
2023-03-26T20:01:31.8587654Z remote: Compressing objects:  40% (13/32)        
2023-03-26T20:01:31.8591450Z remote: Compressing objects:  43% (14/32)        
2023-03-26T20:01:31.8595359Z remote: Compressing objects:  46% (15/32)        
2023-03-26T20:01:31.8597148Z remote: Compressing objects:  50% (16/32)        
2023-03-26T20:01:31.8597796Z remote: Compressing objects:  53% (17/32)        
2023-03-26T20:01:31.8599089Z remote: Compressing objects:  56% (18/32)        
2023-03-26T20:01:31.8600216Z remote: Compressing objects:  59% (19/32)        
2023-03-26T20:01:31.8601471Z remote: Compressing objects:  62% (20/32)        
2023-03-26T20:01:31.8602481Z remote: Compressing objects:  65% (21/32)        
2023-03-26T20:01:31.8603480Z remote: Compressing objects:  68% (22/32)        
2023-03-26T20:01:31.8604451Z remote: Compressing objects:  71% (23/32)        
2023-03-26T20:01:31.8605558Z remote: Compressing objects:  75% (24/32)        
2023-03-26T20:01:31.8606654Z remote: Compressing objects:  78% (25/32)        
2023-03-26T20:01:31.8607608Z remote: Compressing objects:  81% (26/32)        
2023-03-26T20:01:31.8608472Z remote: Compressing objects:  84% (27/32)        
2023-03-26T20:01:31.8609429Z remote: Compressing objects:  87% (28/32)        
2023-03-26T20:01:31.8610503Z remote: Compressing objects:  90% (29/32)        
2023-03-26T20:01:31.8611488Z remote: Compressing objects:  93% (30/32)        
2023-03-26T20:01:31.8612565Z remote: Compressing objects:  96% (31/32)        
2023-03-26T20:01:31.8614393Z remote: Compressing objects: 100% (32/32)        
2023-03-26T20:01:31.8614777Z remote: Compressing objects: 100% (32/32), done.        
2023-03-26T20:01:31.8787888Z remote: Total 38 (delta 4), reused 13 (delta 2), pack-reused 0        
2023-03-26T20:01:31.8891488Z From https://github.com/valentinegb/openai
2023-03-26T20:01:31.8892633Z  * [new ref]         a9514d747bc67f416370d671c8db7ae5663ab3ea -> origin/main
2023-03-26T20:01:31.8931550Z ##[endgroup]
2023-03-26T20:01:31.8932002Z ##[group]Determining the checkout info
2023-03-26T20:01:31.8933443Z ##[endgroup]
2023-03-26T20:01:31.8934799Z ##[group]Checking out the ref
2023-03-26T20:01:31.8943618Z [command]/usr/bin/git checkout --progress --force -B main refs/remotes/origin/main
2023-03-26T20:01:31.9031252Z Switched to a new branch 'main'
2023-03-26T20:01:31.9037129Z branch 'main' set up to track 'origin/main'.
2023-03-26T20:01:31.9045012Z ##[endgroup]
2023-03-26T20:01:31.9113715Z [command]/usr/bin/git log -1 --format='%H'
2023-03-26T20:01:31.9155848Z 'a9514d747bc67f416370d671c8db7ae5663ab3ea'

Reproduction Steps

  1. Create a pull request for the main branch

Expected Behavior

The Rust check should checkout the last commit in the pull request / forked branch.

Workaround

No response

Library Version

1.0.0-alpha.7

rustc Version

1.68.0

cargo Version

1.68.0

Platform

Linux

valentinegb commented 1 year ago

Well that was easier than I thought lol