File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Grant Access to Private Repo
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ username :
7+ description : ' GitHub Username'
8+ required : true
9+
10+ jobs :
11+ check_star_and_grant_access :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Check if user has starred the repo
15+ id : check_star
16+ run : |
17+ curl -s https://api.github.com/repos/hamsadev/EmbeddedC-Tutorials-and-Challenges/stargazers | grep ${{ github.event.inputs.username }} || exit 1
18+
19+ - name : Add user to private repo
20+ if : success()
21+ run : |
22+ curl -X PUT -H "Authorization: token ${{ secrets.GH_TOKEN }}" \
23+ -H "Accept: application/vnd.github.v3+json" \
24+ https://api.github.com/repos/hamsadev/EmbeddedC-Solutions/collaborators/${{ github.event.inputs.username }} \
25+ -d '{"permission":"pull"}'
26+
27+ - name : Send confirmation
28+ if : success()
29+ run : echo "Access granted to private repository for user ${{ github.event.inputs.username }}."
You can’t perform that action at this time.
0 commit comments