Comments (6)
@lgmorand, it looks like there is an even simpler way to detect branch protection just by using process.env.GITHUB_REF_PROTECTED === 'true'
But this won't still fix the token permission issue though. We still need to use the token permission API to determine if the token provided has write access to the repo. But adding branch protection check is the first step.
from keepalive-workflow.
indeed. Branch protection is something you can't do much. but helping to understand that token doesn't have enough rights could be useful
from keepalive-workflow.
it looks like github api do not support it right now:
curl -sS -f -H "Authorization: token <token>" https://api.github.com/repos/example-user/example-repo | jq .permissions
{
"admin": false,
"maintain": false,
"push": false,
"triage": false,
"pull": false
}
This is the response we always get.
there are other users who also have same problem: https://github.com/orgs/community/discussions/25259
Created new bug report here: https://github.com/orgs/community/discussions/73397
from keepalive-workflow.
maybe you could just check the current branch status because token scope won't help in any case I think
https://api.github.com/repos/OWNER/REPO/branches/BRANCH/protection
It would report if the current branch is protected or not. if yes, add a warning/exit
from keepalive-workflow.
@lgmorand thanks a lot for the suggestion. This looks like a great option. Will give it a try. Never knew that this API existed before 😄
from keepalive-workflow.
Will re-open this later, once Github fixes their API.
from keepalive-workflow.
Related Issues (16)
- Documentation on the impact of a "Dummy commit" HOT 8
- denied by branch protections HOT 1
- "unable to access" issue in multiple projects. HOT 5
- Fails with "Unable to Access" HOT 2
- Use branch "keep-alive" HOT 3
- [Question] Write Permission check HOT 4
- Node 20? HOT 1
- Add keepalive using GitHub actions API HOT 2
- Unexpected input(s) 'use_api' during action run HOT 4
- Please update Release 2.0 to say explicitly what needs to change HOT 6
- My workflow has been disabled even if I use this action HOT 2
- Workflow being disabled even though v2 is in use HOT 9
- Extraneous parameters reported in v2 HOT 1
- Action does not complete and causes the parent workflow to fail. (triggered by pull request from fork) HOT 2
- Error when using workflow HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keepalive-workflow.