Open xzima opened 2 years ago
Thank you for your report! It's an interesting one... There are two issues: 1) TypeError: Converting circular structure to JSON This one is an issue with my code, but it doesn't affect the script functionality at all, since it's a code that's only called after another error. 2) Validation Failed: {"resource":"PullRequest","code":"custom","message":"not all refs are readable"} This seems like a permission issue, although I'm not so sure. Can you try the version 0.0.4, so we can rule out some suspicions?
yes, sure!
Here are logs for version 0.0.4:
2022-10-12T16:11:48.0516818Z Requested labels: ubuntu-latest
2022-10-12T16:11:48.0516860Z Job defined at: Goncho-space/goncho-id/.github/workflows/gitflow.yml@refs/heads/rc
2022-10-12T16:11:48.0516882Z Waiting for a runner to pick up this job...
2022-10-12T16:11:48.3688874Z Job is waiting for a hosted runner to come online.
2022-10-12T16:11:51.9270686Z Job is about to start running on the hosted runner: Hosted Agent (hosted)
2022-10-12T16:11:54.6339292Z ##[debug]Starting: 🔨 Create PR
2022-10-12T16:11:54.6370872Z ##[debug]Cleaning runner temp folder: /home/runner/work/_temp
2022-10-12T16:11:54.6772274Z ##[debug]Starting: Set up job
2022-10-12T16:11:54.6772865Z Current runner version: '2.298.2'
2022-10-12T16:11:54.6800347Z ##[group]Operating System
2022-10-12T16:11:54.6800915Z Ubuntu
2022-10-12T16:11:54.6801179Z 20.04.5
2022-10-12T16:11:54.6801474Z LTS
2022-10-12T16:11:54.6801909Z ##[endgroup]
2022-10-12T16:11:54.6802216Z ##[group]Runner Image
2022-10-12T16:11:54.6802611Z Image: ubuntu-20.04
2022-10-12T16:11:54.6803078Z Version: 20221002.2
2022-10-12T16:11:54.6803655Z Included Software: https://github.com/actions/runner-images/blob/ubuntu20/20221002.2/images/linux/Ubuntu2004-Readme.md
2022-10-12T16:11:54.6804267Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu20%2F20221002.2
2022-10-12T16:11:54.6804759Z ##[endgroup]
2022-10-12T16:11:54.6805109Z ##[group]Runner Image Provisioner
2022-10-12T16:11:54.6805431Z 1.0.0.0-main-20220916-1
2022-10-12T16:11:54.6806051Z ##[endgroup]
2022-10-12T16:11:54.6806701Z ##[group]GITHUB_TOKEN Permissions
2022-10-12T16:11:54.6807367Z Metadata: read
2022-10-12T16:11:54.6807767Z PullRequests: write
2022-10-12T16:11:54.6808127Z ##[endgroup]
2022-10-12T16:11:54.6812350Z Secret source: Actions
2022-10-12T16:11:54.6812963Z ##[debug]Primary repository: Goncho-space/goncho-id
2022-10-12T16:11:54.6813439Z Prepare workflow directory
2022-10-12T16:11:54.6911967Z ##[debug]Creating pipeline directory: '/home/runner/work/goncho-id'
2022-10-12T16:11:54.6914759Z ##[debug]Creating workspace directory: '/home/runner/work/goncho-id/goncho-id'
2022-10-12T16:11:54.6916134Z ##[debug]Update context data
2022-10-12T16:11:54.6919100Z ##[debug]Evaluating job-level environment variables
2022-10-12T16:11:54.7756916Z ##[debug]Evaluating job container
2022-10-12T16:11:54.7762132Z ##[debug]Evaluating job service containers
2022-10-12T16:11:54.7764992Z ##[debug]Evaluating job defaults
2022-10-12T16:11:54.7858368Z Prepare all required actions
2022-10-12T16:11:54.8087340Z Getting action download info
2022-10-12T16:11:55.0980314Z Download action repository 'Logerfo/gitflow-action@0.0.4' (SHA:af600fbd8cd970fa53cc1bb632b33af7181a6110)
2022-10-12T16:11:56.1376346Z ##[debug]Download 'https://api.github.com/repos/Logerfo/gitflow-action/tarball/af600fbd8cd970fa53cc1bb632b33af7181a6110' to '/home/runner/work/_actions/_temp_180b6219-e3ca-4cec-8dbb-699ab486730f/a4461cd7-9614-465d-a532-7d884701fd99.tar.gz'
2022-10-12T16:11:56.2937542Z ##[debug]Unwrap 'Logerfo-gitflow-action-af600fb' to '/home/runner/work/_actions/Logerfo/gitflow-action/0.0.4'
2022-10-12T16:11:56.3004122Z ##[debug]Archive '/home/runner/work/_actions/_temp_180b6219-e3ca-4cec-8dbb-699ab486730f/a4461cd7-9614-465d-a532-7d884701fd99.tar.gz' has been unzipped into '/home/runner/work/_actions/Logerfo/gitflow-action/0.0.4'.
2022-10-12T16:11:56.3223264Z ##[debug]action.yml for action: '/home/runner/work/_actions/Logerfo/gitflow-action/0.0.4/action.yml'.
2022-10-12T16:11:56.4254660Z ##[debug]Set step '__Logerfo_gitflow-action' display name to: 'Run Logerfo/gitflow-action@0.0.4'
2022-10-12T16:11:56.4262255Z ##[debug]Collect running processes for tracking orphan processes.
2022-10-12T16:11:56.4655771Z ##[debug]Finishing: Set up job
2022-10-12T16:11:56.4915717Z ##[debug]Evaluating condition for step: 'Run Logerfo/gitflow-action@0.0.4'
2022-10-12T16:11:56.5107162Z ##[debug]Evaluating: success()
2022-10-12T16:11:56.5114678Z ##[debug]Evaluating success:
2022-10-12T16:11:56.5151797Z ##[debug]=> true
2022-10-12T16:11:56.5161843Z ##[debug]Result: true
2022-10-12T16:11:56.5212159Z ##[debug]Starting: Run Logerfo/gitflow-action@0.0.4
2022-10-12T16:11:56.5455590Z ##[debug]Loading inputs
2022-10-12T16:11:56.5529232Z ##[debug]Evaluating: secrets.GITHUB_TOKEN
2022-10-12T16:11:56.5530510Z ##[debug]Evaluating Index:
2022-10-12T16:11:56.5533080Z ##[debug]..Evaluating secrets:
2022-10-12T16:11:56.5534443Z ##[debug]..=> Object
2022-10-12T16:11:56.5550618Z ##[debug]..Evaluating String:
2022-10-12T16:11:56.5551543Z ##[debug]..=> 'GITHUB_TOKEN'
2022-10-12T16:11:56.5558022Z ##[debug]=> '***'
2022-10-12T16:11:56.5560609Z ##[debug]Result: '***'
2022-10-12T16:11:56.5575157Z ##[debug]Loading env
2022-10-12T16:11:56.5692308Z ##[group]Run Logerfo/gitflow-action@0.0.4
2022-10-12T16:11:56.5692626Z with:
2022-10-12T16:11:56.5693171Z github-token: ***
2022-10-12T16:11:56.5693888Z release: rc
2022-10-12T16:11:56.5694149Z master: master
2022-10-12T16:11:56.5694393Z dev: develop
2022-10-12T16:11:56.5694660Z auto-merge: false
2022-10-12T16:11:56.5694871Z label: gitflow
2022-10-12T16:11:56.5695102Z require-merge: false
2022-10-12T16:11:56.5695351Z ##[endgroup]
2022-10-12T16:11:56.9365103Z ##[debug]{"after":"fd85caff78ef39508823967e2ab51bc31484d220","base_ref":null,"before":"18a7167eb48bfcdf08488fb270bb1ef33ac58146","commits":[{"author":{"email":"xzima@ro.ru","name":"Alex Zima","username":"xzima"},"committer":{"email":"xzima@ro.ru","name":"Alex Zima","username":"xzima"},"distinct":true,"id":"fd85caff78ef39508823967e2ab51bc31484d220","message":"ci: rollback gitflow.yml action version","timestamp":"2022-10-12T19:09:40+03:00","tree_id":"6cc3279ddccf74f6982b8566d75ff146e0f6f363","url":"https://github.com/Goncho-space/goncho-id/commit/fd85caff78ef39508823967e2ab51bc31484d220"}],"compare":"https://github.com/Goncho-space/goncho-id/compare/18a7167eb48b...fd85caff78ef","created":false,"deleted":false,"forced":false,"head_commit":{"author":{"email":"xzima@ro.ru","name":"Alex Zima","username":"xzima"},"committer":{"email":"xzima@ro.ru","name":"Alex Zima","username":"xzima"},"distinct":true,"id":"fd85caff78ef39508823967e2ab51bc31484d220","message":"ci: rollback gitflow.yml action version","timestamp":"2022-10-12T19:09:40+03:00","tree_id":"6cc3279ddccf74f6982b8566d75ff146e0f6f363","url":"https://github.com/Goncho-space/goncho-id/commit/fd85caff78ef39508823967e2ab51bc31484d220"},"organization":{"avatar_url":"https://avatars.githubusercontent.com/u/105038379?v=4","description":null,"events_url":"https://api.github.com/orgs/Goncho-space/events","hooks_url":"https://api.github.com/orgs/Goncho-space/hooks","id":105038379,"issues_url":"https://api.github.com/orgs/Goncho-space/issues","login":"Goncho-space","members_url":"https://api.github.com/orgs/Goncho-space/members{/member}","node_id":"O_kgDOBkLCKw","public_members_url":"https://api.github.com/orgs/Goncho-space/public_members{/member}","repos_url":"https://api.github.com/orgs/Goncho-space/repos","url":"https://api.github.com/orgs/Goncho-space"},"pusher":{"email":"xzima@ro.ru","name":"xzima"},"ref":"refs/heads/rc","repository":{"allow_forking":false,"archive_url":"https://api.github.com/repos/Goncho-space/goncho-id/{archive_format}{/ref}","archived":false,"assignees_url":"https://api.github.com/repos/Goncho-space/goncho-id/assignees{/user}","blobs_url":"https://api.github.com/repos/Goncho-space/goncho-id/git/blobs{/sha}","branches_url":"https://api.github.com/repos/Goncho-space/goncho-id/branches{/branch}","clone_url":"https://github.com/Goncho-space/goncho-id.git","collaborators_url":"https://api.github.com/repos/Goncho-space/goncho-id/collaborators{/collaborator}","comments_url":"https://api.github.com/repos/Goncho-space/goncho-id/comments{/number}","commits_url":"https://api.github.com/repos/Goncho-space/goncho-id/commits{/sha}","compare_url":"https://api.github.com/repos/Goncho-space/goncho-id/compare/{base}...{head}","contents_url":"https://api.github.com/repos/Goncho-space/goncho-id/contents/{+path}","contributors_url":"https://api.github.com/repos/Goncho-space/goncho-id/contributors","created_at":1664801653,"default_branch":"master","deployments_url":"https://api.github.com/repos/Goncho-space/goncho-id/deployments","description":"keycloak fork with custom theme and plugins","disabled":false,"downloads_url":"https://api.github.com/repos/Goncho-space/goncho-id/downloads","events_url":"https://api.github.com/repos/Goncho-space/goncho-id/events","fork":false,"forks":0,"forks_count":0,"forks_url":"https://api.github.com/repos/Goncho-space/goncho-id/forks","full_name":"Goncho-space/goncho-id","git_commits_url":"https://api.github.com/repos/Goncho-space/goncho-id/git/commits{/sha}","git_refs_url":"https://api.github.com/repos/Goncho-space/goncho-id/git/refs{/sha}","git_tags_url":"https://api.github.com/repos/Goncho-space/goncho-id/git/tags{/sha}","git_url":"git://github.com/Goncho-space/goncho-id.git","has_downloads":true,"has_issues":true,"has_pages":false,"has_projects":true,"has_wiki":true,"homepage":null,"hooks_url":"https://api.github.com/repos/Goncho-space/goncho-id/hooks","html_url":"https://github.com/Goncho-space/goncho-id","id":544908635,"is_template":false,"issue_comment_url":"https://api.github.com/repos/Goncho-space/goncho-id/issues/comments{/number}","issue_events_url":"https://api.github.com/repos/Goncho-space/goncho-id/issues/events{/number}","issues_url":"https://api.github.com/repos/Goncho-space/goncho-id/issues{/number}","keys_url":"https://api.github.com/repos/Goncho-space/goncho-id/keys{/key_id}","labels_url":"https://api.github.com/repos/Goncho-space/goncho-id/labels{/name}","language":"TypeScript","languages_url":"https://api.github.com/repos/Goncho-space/goncho-id/languages","license":null,"master_branch":"master","merges_url":"https://api.github.com/repos/Goncho-space/goncho-id/merges","milestones_url":"https://api.github.com/repos/Goncho-space/goncho-id/milestones{/number}","mirror_url":null,"name":"goncho-id","node_id":"R_kgDOIHqlWw","notifications_url":"https://api.github.com/repos/Goncho-space/goncho-id/notifications{?since,all,participating}","open_issues":0,"open_issues_count":0,"organization":"Goncho-space","owner":{"avatar_url":"https://avatars.githubusercontent.com/u/105038379?v=4","email":null,"events_url":"https://api.github.com/users/Goncho-space/events{/privacy}","followers_url":"https://api.github.com/users/Goncho-space/followers","following_url":"https://api.github.com/users/Goncho-space/following{/other_user}","gists_url":"https://api.github.com/users/Goncho-space/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/Goncho-space","id":105038379,"login":"Goncho-space","name":"Goncho-space","node_id":"O_kgDOBkLCKw","organizations_url":"https://api.github.com/users/Goncho-space/orgs","received_events_url":"https://api.github.com/users/Goncho-space/received_events","repos_url":"https://api.github.com/users/Goncho-space/repos","site_admin":false,"starred_url":"https://api.github.com/users/Goncho-space/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Goncho-space/subscriptions","type":"Organization","url":"https://api.github.com/users/Goncho-space"},"private":true,"pulls_url":"https://api.github.com/repos/Goncho-space/goncho-id/pulls{/number}","pushed_at":1665590912,"releases_url":"https://api.github.com/repos/Goncho-space/goncho-id/releases{/id}","size":408,"ssh_url":"git@github.com:Goncho-space/goncho-id.git","stargazers":0,"stargazers_count":0,"stargazers_url":"https://api.github.com/repos/Goncho-space/goncho-id/stargazers","statuses_url":"https://api.github.com/repos/Goncho-space/goncho-id/statuses/{sha}","subscribers_url":"https://api.github.com/repos/Goncho-space/goncho-id/subscribers","subscription_url":"https://api.github.com/repos/Goncho-space/goncho-id/subscription","svn_url":"https://github.com/Goncho-space/goncho-id","tags_url":"https://api.github.com/repos/Goncho-space/goncho-id/tags","teams_url":"https://api.github.com/repos/Goncho-space/goncho-id/teams","topics":[],"trees_url":"https://api.github.com/repos/Goncho-space/goncho-id/git/trees{/sha}","updated_at":"2022-10-11T18:18:12Z","url":"https://github.com/Goncho-space/goncho-id","visibility":"private","watchers":0,"watchers_count":0,"web_commit_signoff_required":false},"sender":{"avatar_url":"https://avatars.githubusercontent.com/u/57903499?v=4","events_url":"https://api.github.com/users/xzima/events{/privacy}","followers_url":"https://api.github.com/users/xzima/followers","following_url":"https://api.github.com/users/xzima/following{/other_user}","gists_url":"https://api.github.com/users/xzima/gists{/gist_id}","gravatar_id":"","html_url":"https://github.com/xzima","id":57903499,"login":"xzima","node_id":"MDQ6VXNlcjU3OTAzNDk5","organizations_url":"https://api.github.com/users/xzima/orgs","received_events_url":"https://api.github.com/users/xzima/received_events","repos_url":"https://api.github.com/users/xzima/repos","site_admin":false,"starred_url":"https://api.github.com/users/xzima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xzima/subscriptions","type":"User","url":"https://api.github.com/users/xzima"}}
2022-10-12T16:11:57.3862392Z ##[debug][]
2022-10-12T16:11:58.0598299Z ##[error]Validation Failed: {"resource":"PullRequest","code":"custom","message":"not all refs are readable"}
2022-10-12T16:11:58.0657606Z ##[debug]{"name":"HttpError","status":422,"headers":{"access-control-allow-origin":"*","access-control-expose-headers":"ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset","connection":"close","content-length":"212","content-security-policy":"default-src 'none'","content-type":"application/json; charset=utf-8","date":"Wed, 12 Oct 2022 16:11:57 GMT","referrer-policy":"origin-when-cross-origin, strict-origin-when-cross-origin","server":"GitHub.com","strict-transport-security":"max-age=31536000; includeSubdomains; preload","vary":"Accept-Encoding, Accept, X-Requested-With","x-content-type-options":"nosniff","x-frame-options":"deny","x-github-media-type":"github.v3; format=json","x-github-request-id":"0542:93FF:2B872D:2CCE8B:6346E74D","x-ratelimit-limit":"1000","x-ratelimit-remaining":"973","x-ratelimit-reset":"1665591631","x-ratelimit-resource":"core","x-ratelimit-used":"27","x-xss-protection":"0"},"request":{"method":"POST","url":"https://api.github.com/repos/Goncho-space/goncho-id/pulls","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/16.33.1 Node.js/12.22.7 (Linux 5.15; x64)","authorization":"token [REDACTED]","content-type":"application/json; charset=utf-8"},"body":"{\"base\":\"master\",\"head\":\"rc\",\"title\":\"rc -> master\"}","request":{"validate":{"base":{"required":true,"type":"string"},"body":{"type":"string"},"draft":{"type":"boolean"},"head":{"required":true,"type":"string"},"maintainer_can_modify":{"type":"boolean"},"owner":{"required":true,"type":"string"},"repo":{"required":true,"type":"string"},"title":{"required":true,"type":"string"}}}},"errors":[{"resource":"PullRequest","code":"custom","message":"not all refs are readable"}],"documentation_url":"https://docs.github.com/rest/reference/pulls#create-a-pull-request"}
2022-10-12T16:11:58.0677807Z ##[debug]Node Action run completed with exit code 1
2022-10-12T16:11:58.0856950Z ##[debug]Finishing: Run Logerfo/gitflow-action@0.0.4
2022-10-12T16:11:58.1016302Z ##[debug]Starting: Complete job
2022-10-12T16:11:58.1018320Z Uploading runner diagnostic logs
2022-10-12T16:11:58.1092458Z ##[debug]Starting diagnostic file upload.
2022-10-12T16:11:58.1092789Z ##[debug]Setting up diagnostic log folders.
2022-10-12T16:11:58.1095132Z ##[debug]Creating diagnostic log files folder.
2022-10-12T16:11:58.1118176Z ##[debug]Copying 1 worker diagnostic logs.
2022-10-12T16:11:58.1138509Z ##[debug]Copying 1 runner diagnostic logs.
2022-10-12T16:11:58.1140070Z ##[debug]Zipping diagnostic files.
2022-10-12T16:11:58.1186362Z ##[debug]Uploading diagnostic metadata file.
2022-10-12T16:11:58.1222463Z ##[debug]Diagnostic file upload complete.
2022-10-12T16:11:58.1223087Z Completed runner diagnostic log upload
2022-10-12T16:11:58.1223361Z Cleaning up orphan processes
2022-10-12T16:11:58.1617241Z ##[debug]Finishing: Complete job
2022-10-12T16:11:58.1781836Z ##[debug]Finishing: 🔨 Create PR
permissions for workflows are granted at the repository level
Thanks! This is evidence that the TypeError issue only happens in 0.0.5, but the Validation issue happens regardless of the version. It's curious that the permission settings for your repository seems fine, but I was never aware of someone having this specific issue.
It's possible to customize the permissions granted to secrets.GITHUB_TOKEN
, documented here and here, but I'm not sure if that's the case.
It's a private repository, right? Is it a fork? Are the pull request's base and target repository the same? Is there any restricted branch, tag or any kind of ref?
yes, it's a private repository. no, it's not a fork. yes, the base and target repository are the same. I use only branches.
the repository is owned by the organization. it might be important but I'm not sure
perhaps the problem is in the head parameter when calling the pulls.create method, but this needs to be checked
Can you try creating a new Personal access token with "repo" rights and add the token as a secret in your organization repository? Then you can replace ${{ secrets.GITHUB_TOKEN }}
with ${{ secrets.YOUR_SECRET }}
in the workflow file. But as it's an organization, please beware that you might be exposing your access token to other members. If that's a problem, this might be a safer but more bureaucratic way.
I'm not sure if this will work, neither calling it as a final solution if it does. I'm still trying to understand the problem and this is a trial-and-error shot.
Thank you!
Your advice really helped. after several experiments, I came to the conclusion that it will be enough to register the following permissions:
permissions:
contents: read
pull-requests: write
That's great news! I've updated the project README to include those permissions settings in the workflow examples. I'll keep this issue open because of the circular serialization problem, but I can't prioritize this for now. Thanks!
Hi!
I am getting error when I run your latest Logerfo/gitflow-action@0.0.5.
My config:
logs: