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

Extend awards action #1937

Merged
merged 2 commits into from
Mar 3, 2025
Merged

Conversation

Scroogey-SN
Copy link
Contributor

Description

Implements #1849

Pass ${{ github }} through env var GITHUB_CONTEXT to the script instead of passing it on the command line.

Tested with various PR body texts (backticks, single quotes, double quote, new lines, unicode, etc.) and multiple PR merge methods (squash, merge, etc.).

@Scroogey-SN
Copy link
Contributor Author

Security hardening for GitHub Actions covers this in detail.

@Scroogey-SN Scroogey-SN force-pushed the extend_awards_action branch from 5de0d93 to e0ebd2f Compare March 2, 2025 13:42
… PRs generated by action don't invoke action again
@huumn huumn merged commit 2710430 into stackernews:master Mar 3, 2025
6 checks passed
@huumn
Copy link
Member

huumn commented Mar 3, 2025

It failed again but it looks related to repo permissions. I'm not sure what needs to change.

@Scroogey-SN
Copy link
Contributor Author

I'll check.

@Scroogey-SN
Copy link
Contributor Author

It seems the permission can be set on enterprise, organization, and repository level:

https://stackoverflow.com/questions/72376229/github-actions-is-not-permitted-to-create-or-approve-pull-requests-createpullre

But you previously posted a screenshot showing it enabled in the repo, so it might not be this.

@Scroogey-SN
Copy link
Contributor Author

As per Modifying the permissions for the GITHUB_TOKEN you can see the permissions of the token in the Actions log:

screenshot

You have 'read' for everything, while my private test repo shows 'write' there.

The link above explains how this can be changed in enterprise/organization levels.

We can try to add a permissions: line in the .yml.

@Scroogey-SN
Copy link
Contributor Author

Scroogey-SN commented Mar 3, 2025

Check this first: https://docs.github.com/en/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#configuring-the-default-github_token-permissions

If it is restricted, set to permissive. If it's already permissive, adding a permission: line to the .yml would be next to try:

In .github/workflows/extend-awards.yml, add a permissions: line right before the jobs: line

permissions: write-all
jobs:

@huumn
Copy link
Member

huumn commented Mar 3, 2025

Both the repo and the org have read/write enabled. It was the first thing I checked. I guess we need the yaml thing.

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

Successfully merging this pull request may close these issues.

2 participants