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

Submission CI: restrict !redo for only authors and admins of repo #60

Closed
IceKhan13 opened this issue Oct 21, 2021 · 9 comments · Fixed by #88
Closed

Submission CI: restrict !redo for only authors and admins of repo #60

IceKhan13 opened this issue Oct 21, 2021 · 9 comments · Fixed by #88
Assignees
Labels
enhancement New feature or request priority: low Low priority tasks

Comments

@IceKhan13
Copy link
Member

What is the expected enhancement?

Currently anyone can type !redo and spam our CI with job requests.
We need to restrict this possibility to only authors and admins (members of community) of repo

@IceKhan13 IceKhan13 added enhancement New feature or request priority: high High priority tasks priority: normal Normal priority tasks and removed priority: high High priority tasks labels Oct 21, 2021
@IceKhan13 IceKhan13 mentioned this issue Oct 25, 2021
2 tasks
@IceKhan13
Copy link
Member Author

IceKhan13 commented Oct 26, 2021

@mickahell Do you have a pattern for restrict only authors and admins to trigger action?

@mickahell
Copy link
Collaborator

@mickahell Do you have a pattern for restrict only authors and admins to trigger action?

For the triggering part I don't know it seems to depend of the setting of the repo

BUT to avoid having lot of same actions with for the same issue in the same time we can use :

concurrency: ci-${{ github.event.issue.title }}
  cancel-in-progress: true

That's way cancel previous action from the same issue

@mickahell
Copy link
Collaborator

@IceKhan13 did you see my response ?

@IceKhan13
Copy link
Member Author

IceKhan13 commented Oct 28, 2021

We do not have a problem that same issue will be triggered, we have a problem that anyone can trigger them =(

I think we can handle this in actions itself, something like

if: ${{github.event.user == github.event.issue.author}} || ${{github.event.user._is_contributor}}

Something like this :)

@IceKhan13
Copy link
Member Author

We will discuss it on tomorrows sync and I'll post here solution we will come up with for transparency

@mickahell
Copy link
Collaborator

We do not have a problem that same issue will be triggered, we have a problem that anyone can trigger them =(

I think we can handle this in actions itself, something like

if: ${{github.event.user == github.event.issue.author}} || ${{github.event.user._is_contributor}}

Something like this :)

I guess it has a var for _is_contributor but I don't find any :/

@mickahell
Copy link
Collaborator

Apparently we can get all of the vars like this :

- name: Dump GitHub context

  env:

       GITHUB_CONTEXT: ${{ toJson(github) }}

  run: echo "$GITHUB_CONTEXT"

https://github.community/t/how-to-find-the-default-variables-for-each-github-action-variable/17162/2

@IceKhan13
Copy link
Member Author

Something like that

if: ${{github.event.issue.user.type == "Author"}} || ${{github.event.issue.user.type == "Contributor"}} || ${{github.event.issue.user.type == "Admin"}}

https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#issue_comment

@IceKhan13 IceKhan13 added priority: low Low priority tasks and removed priority: normal Normal priority tasks labels Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority: low Low priority tasks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants