Skip to content

Declare permissions for lint_pr_labels#12413

Merged
alecslupu merged 1 commit intodecidim:developfrom
jsoref:lint-pr-labels-needs-pull-requests-write
Mar 14, 2024
Merged

Declare permissions for lint_pr_labels#12413
alecslupu merged 1 commit intodecidim:developfrom
jsoref:lint-pr-labels-needs-pull-requests-write

Conversation

@jsoref
Copy link
Copy Markdown
Contributor

@jsoref jsoref commented Feb 12, 2024

🎩 What? Why?

Without this, this workflow fails for PRs in forks

📌 Related Issues

Testing

Create a PR in a fork to a branch with this workflow fixed:
check-spelling-sandbox#2 (review)

📷 Screenshots

image

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']

@alecslupu alecslupu added the type: internal PRs that aren't necessary to add to the CHANGELOG for implementers label Feb 12, 2024
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have checked the proposed fix, and i am not 100 % that is fixed.

https://github.com/tremend-cofe/decidim/actions/runs/7870619005/job/21473093143?pr=304

Valid labels are: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']
Invalid labels are: ['type: bug']
PR reviews are: enabled
Pull request number: 304
Error! This pull request does not contain any of the valid labels: ['type: feature', 'type: change', 'type: fix', 'type: removal', 'target: developer-experience', 'type: internal']
This pull request does not contain invalid labels
Traceback (most recent call last):
  File "/verify_pr_lables.py", line 244, in <module>
    event='REQUEST_CHANGES')
  File "/usr/local/lib/python3.6/site-packages/github/PullRequest.py", line 485, in create_review
    "POST", self.url + "/reviews", input=post_parameters
  File "/usr/local/lib/python3.6/site-packages/github/Requester.py", line 319, in requestJsonAndCheck
    verb, url, parameters, headers, input, self.__customConnection(url)
  File "/usr/local/lib/python3.6/site-packages/github/Requester.py", line 342, in __check
    raise self.__createException(status, responseHeaders, output)
github.GithubException.GithubException: 403 {"message": "Resource not accessible by integration", "documentation_url": "https://docs.github.com/rest/pulls/reviews#create-a-review-for-a-pull-request"}

This are my repo permissions.
image

@jsoref
Copy link
Copy Markdown
Contributor Author

jsoref commented Feb 12, 2024

You need to create a PR into https://github.com/tremend-cofe/decidim/tree/text/permissions -- the changes you made to the workflow don't apply to the workflow when it's in the PR because of the behavior of pull_request_target -- for that event the workflow that runs is the workflow as defined in the BASE of the PR not the HEAD of the PR.

(Yes, it's confusing.)

@jsoref
Copy link
Copy Markdown
Contributor Author

jsoref commented Feb 12, 2024

You can see that it worked there: i-need-another-coffee#305 (review)

@andreslucena
Copy link
Copy Markdown
Member

Waiting for the last review from @alecslupu so he can merge

Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Openeing PR into this branch, did not triggered any Error as i previously reported.
@jsoref thanks for your contribution!

@alecslupu alecslupu merged commit c5df7dd into decidim:develop Mar 14, 2024
@jsoref jsoref deleted the lint-pr-labels-needs-pull-requests-write branch March 14, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: internal PRs that aren't necessary to add to the CHANGELOG for implementers

Projects

No open projects
Archived in project

Development

Successfully merging this pull request may close these issues.

.github/workflows/lint_pr_labels.yml doesn't declare permissions and thus doesn't work in paranoid forks

3 participants