nodejs / release-cloudflare-worker

Infra for serving Node.js downloads and documentation.
https://nodejs.org/dist
MIT License
21 stars 5 forks source link

actions: write updates directly to redirectLinks.json to main #85

Closed flakey5 closed 7 months ago

flakey5 commented 7 months ago

Closes #66

flakey5 commented 7 months ago

The deploy step is failing https://github.com/nodejs/release-cloudflare-worker/actions/runs/6933469355/job/18859682904, I assumed secrets.GH_USER_TOKEN would work automatically but that looks to not be the case. How can we go about adding it

MoLow commented 7 months ago

Is my help needed here? I can add a token if still needed

ovflowd commented 7 months ago

The deploy step is failing nodejs/release-cloudflare-worker/actions/runs/6933469355/job/18859682904, I assumed secrets.GH_USER_TOKEN would work automatically but that looks to not be the case. How can we go about adding it

You can simply just add the example mentioned there. But in general, these should be triggered on the "behalf" of an user. Adding the default token there might give an error that this Token has no access to this resource. Pretty much because GitHub Actions Tokens have access/scope only for that specific GitHub Workflow and Run.

targos commented 7 months ago

GH_USER_TOKEN is not the token generated by GitHub actions. If you want to use that one, it's GITHUB_TOKEN

ovflowd commented 7 months ago

GH_USER_TOKEN is not the token generated by GitHub actions. If you want to use that one, it's GITHUB_TOKEN

Right, yes. We need to pretty much then provide an user token.

MoLow commented 7 months ago

The workflow did not fail due to credentials, it failed because main is a protectd branch:

https://github.com/nodejs/release-cloudflare-worker/actions/runs/6964068075/job/18950729144#step:6:40

remote: error: GH006: Protected branch update failed for refs/heads/main.
remote: error: Changes must be made through a pull request. 3 of 3 required status checks are expected.

ovflowd commented 7 months ago

The workflow did not fail due to credentials, it failed because main is a protectd branch:

https://github.com/nodejs/release-cloudflare-worker/actions/runs/6964068075/job/18950729144#step:6:40

remote: error: GH006: Protected branch update failed for refs/heads/main.

remote: error: Changes must be made through a pull request. 3 of 3 required status checks are expected.

Huh? Interesting. We could bypass the rule for github actions (user I think?)

MoLow commented 7 months ago

yes, I am looking into this now

targos commented 7 months ago

I suggest to work with pull requests, even for automation. You can enable auto-merge in the repo settings and do something like this in a workflow (assuming token with enough permissions):

          # somehow create a branch and commit
          gh pr create --title "title" --body ""
          gh pr merge --auto --squash