Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: worklow: add permissions field #2312

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Frankkkkk
Copy link

The permissions field can either be a top level key, or a per-job one. It supports a map of scope<>permission relations.
For example, to allow the jobs to write to the the packages registry, the following must be set:

permissions:
  packages: write

this fixes that.
Right now, this field is not used/useful when running the actions locally, but can be used to handle permissions on forges that implement the same action format, such as Forgejo/Gitea.

The `permissions` field can either be a top level key, or a per-job one.
It supports a map of scope<>permission relations.
For example, to allow the jobs to write to the the packages registry,
the following must be set:
```yaml
permissions:
  packages: write
```

this fixes that.
Right now, this field is not used/useful when running the actions
locally, but can be used to handle permissions on forges that implement the
same action format, such as Forgejo/Gitea.

Signed-off-by: Frank Villaro-Dixon <[email protected]>
@Frankkkkk Frankkkkk requested a review from a team as a code owner May 1, 2024 21:00
@ChristopherHX
Copy link
Contributor

Notice: permissions: write-all and permissions: read-all are valid as well, but cannot be parsed to a map.

@Frankkkkk
Copy link
Author

Frankkkkk commented May 1, 2024

Good catch, indeed! What do you propose? Would having something like:

type Permission interface {}
...
Permissions Permission `yaml:"permissions"`

be better? Thanks!

@ChristopherHX
Copy link
Contributor

I usually use yaml.Node as the type, since this allows to call decode to both string and map

However I'm not shure how the rest of the code is it doing here...

@ChristopherHX
Copy link
Contributor

Also check the gitea/act repo, and you will see this struct is duplicated there into another package on their standalone workflow parser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants