ProjectPythia / cookbook-template

Project Pythia Cookbook template
https://projectpythia.org/cookbook-template/
Apache License 2.0
23 stars 17 forks source link

trigger-replace-links workflow not working #129

Closed brian-rose closed 8 months ago

brian-rose commented 1 year ago

Maybe this is user error, but I just tried to run the trigger-replace-links.yaml workflow manually from a newly created cookbook. Before running the action, I set the "Ready and write permissions" for workflows following step 6 of this section of the contributors guide.

Despite that setting, the workflow seems to be failing due to a permission issue:

@jukent have you seen this before?

INPUT_PUSH_OPTIONS: 
[41](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:42)
To https://github.com/brian-rose/fake-cookbook
[42](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:43)
 ! [remote rejected] main -> main (refusing to allow a GitHub App to create or update workflow `.github/workflows/trigger-replace-links.yaml` without `workflows` permission)
[43](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:44)
error: failed to push some refs to 'https://github.com/brian-rose/fake-cookbook'
[44](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:45)
Error: Invalid status code: 1
[45](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:46)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19)
[46](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:47)
    at ChildProcess.emit (node:events:527:28)
[47](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:48)
    at maybeClose (node:internal/child_process:1092:16)
[48](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:49)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5) {
[49](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:50)
  code: 1
[50](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:51)
}
[51](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:52)
Error: Invalid status code: 1
[52](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:53)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v4/index.js:17:19)
[53](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:54)
    at ChildProcess.emit (node:events:527:28)
[54](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:55)
    at maybeClose (node:internal/child_process:1092:16)
[55](https://github.com/brian-rose/fake-cookbook/actions/runs/5402998310/jobs/9815140054#step:6:56)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
jukent commented 1 year ago

@brian-rose can you link me to the repository that you are running this on? I've encountered differences in workflow permissions when running on a fork or upstream before (even with the same settings checked as far as I could tell).

brian-rose commented 1 year ago

https://github.com/brian-rose/fake-cookbook

But I just manually pushed an edit that fixed all the links.

jukent commented 1 year ago

Looking closer at this, I am noticing this line as the cruz ! [remote rejected] main -> main (refusing to allow a GitHub App to create or update workflow.github/workflows/trigger-replace-links.yamlwithoutworkflowspermission, and this one is concerning because we don't want workflows permission anyway, we don't want to edit the trigger-replace-links.yml file, but it could try to because the find and replace "find" field of ProjectPythia/cookbook-template also exists here. I had added an except statement to not look at this file when I was getting a similar issue.

jukent commented 1 year ago

I can see that it is trying to edit the workflow file

From https://github.com/brian-rose/fake-cookbook
 * [new branch]      gh-pages   -> origin/gh-pages
M   .github/workflows/trigger-replace-links.yaml
M   CITATION.cff
M   README.md
M   _config.yml
M   notebooks/how-to-cite.md
Your branch is up to date with 'origin/main'.

even though .github/workflows/trigger-replace-links.yaml is set to exclude

brian-rose commented 1 year ago

Ah, I think there is a typo in this line

It should be .yaml instead of .yml

jukent commented 1 year ago

I bet that's it!

jukent commented 1 year ago

Should we standardize .yml vs .yaml across the project?

brian-rose commented 1 year ago

Should we standardize .yml vs .yaml across the project?

I've tried to standardize on .yaml for the GitHub workflow files at least. It's a personal preference of mine. But the rest of the world doesn't always cooperate unfortunately:

So switching everything to .yaml might break some things. But we can at least be internally consistent within our workflow files.

brian-rose commented 1 year ago

Following these very terse recommendations: http://yaml.org/faq.html

jukent commented 1 year ago

Sounds like a plan. I can change all the _gallery_info.ymls if we want, but that seems like a good deal of work.

brian-rose commented 1 year ago

Sounds like a plan. I can change all the _gallery_info.ymls if we want, but that seems like a good deal of work.

Nah, I would leave it the way it is. Then all the yaml files at the root level of the repo have the same extension, which keeps my brain from complaining too much.