typesafegithub/github-workflows-kt

Not succeeding in excuting "check_yaml_consistency"

Closed this issue · 11 comments

Action

Describe what you are trying to do.

I would like to excute refreshVersions and create a kts.
https://gist.github.com/S-H-Y-A/64e92ebb62799934277ac0a99c473e80

Expected

RefreshVersion will be excuted.

Actual

Throwed error before excute Refresh-Versions job:
/home/runner/work/_temp/8d8792f9-3d76-4160-904d-057ca2980cea.sh: line 1: .github/workflows/refreshVerions.main.kts: Permission denied
image

But I think I cannot permit to access these file on GitHub Actions with github-workflows-kt. How to solve it?

Library version

v0.33.0

Hi @S-H-Y-A! Please make the script executable, e. g. on Linux:

chmod +x filename

It's mentioned in the docs: https://krzema12.github.io/github-workflows-kt/user-guide/getting_started/

Actually, I tried it. Then, I got another error:

Run git diff --exit-code '.github/workflows/refreshVersions.yaml'
diff --git a/.github/workflows/refreshVersions.yaml b/.github/workflows/refreshVersions.yaml
old mode 100755
new mode 100644
Error: Process completed with exit code 1.

Hmm, something's off here. We've never had these issues. Is it the whole output? Could you point me to a reproducer?

@S-H-Y-A can you just modify the permissions of the YAML file, like the diff suggests? Alternatively, remove the YAML and regenerate it.

diff --git a/.github/workflows/refreshVersions.yaml b/.github/workflows/refreshVersions.yaml 
old mode 100755
new mode 100644

This means that the file which is uploaded by me on GitHub is 755 mode and that the other file which is regenerated by GitHub Actions is 644 mode, so GitHub Actions throw Error: Process completed with exit code 1.

If I upload the 644 mode fIle, GitHub will throw error: Permission denied because a 644 mode file cann't be removed when GitHubActions execute Executes Script, check_yaml_consistency.
And if I upload the 755 mode file, GitHub will throws error

old mode 100755
new mode 100644
Error: Process completed with exit code 1.

when GitHubActions executes Consistency Check, check_yaml_consistency.
because GitHub Actions regenerates the 644 mode file and it is different from that of the original file.

I forked your reproducer repo and added a commit that removes execution permission for the YAML:

image

The consistency check succeeded: https://github.com/krzema12/GitHubWorkFlowKtTestSample/actions/runs/3827731785/jobs/6512569175 and refreshVersions created this PR: https://github.com/krzema12/GitHubWorkFlowKtTestSample/pull/1

You wrote:

If I upload the 644 mode fIle, GitHub will throw error: Permission denied because a 644 mode file cann't be removed when GitHubActions execute Executes Script, check_yaml_consistency.

I don't see any workflow run in your repo that shows this. Could you provide a reproduction for it? My above change shows that 644 works fine.

755466
I made both 644 and 755 workflows, and both throw error which is different from each other.
Commit
Actions: RefreshVersions-644 #1
Actions: RefreshVersions-755 #1

The Kotlin script always has to be executable. So to sum up, the permissions should look like this:

  • Kotlin script: 755
  • YAML: 664

Thank you.
I solve this probrem with it.
I'm sorry for the trouble.