feat: use actions/github-script instead of running node directly#27
feat: use actions/github-script instead of running node directly#27SimenB wants to merge 2 commits into
Conversation
| if (data.mergeable_state === 'clean') { | ||
| process.exit(0); | ||
| console.log(data); | ||
| if (data.mergeable_state === 'clean') { |
There was a problem hiding this comment.
I wasn't really able to test this one on my branch as I had issues getting the test action to run for some reason... How did you test?
There was a problem hiding this comment.
Created a new repo with some simple js scripts and a small test suite, kept polling the GitHub API until the mergeable_state became 'clean'. At creation, it's set to 'unknown'. Then it goes 'unstable' until checks pass, which set that variable to 'clean'
There was a problem hiding this comment.
Right, but it's never clean due to missing approval, and if approval is added, it might be mergable right away. I think.
Anyways, if automerge doesn't work, we can iterate. Getting the PR to begin with is a great start as it can be merged from mobile, no need to run the script from desktop
|
|
||
| await setTimeout(retryDelay); | ||
| export default async function(github, owner, repository, pull_number) { | ||
| const repo = repository.replace(new RegExp(`${owner}/`), '') |
There was a problem hiding this comment.
might be enough to do const [owner, repo] = repository.split('/')? not sure if it's legal with other / which can mess this up
There was a problem hiding this comment.
Can't think of a one-liner for that. I would split, use the first part and join the other parts.

(this got too big to add as suggestion in the PR, sorry)
We use
actions/github-scriptelsewhere, and it gives us a nicegithubclient we can use instead of usingfetch.Make sure to ignore whitespace to make this reviewable at all: https://github.com/Pehesi97/docker-node/pull/27/files?w=1