-
Notifications
You must be signed in to change notification settings - Fork 741
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
fix: find correct permission #1230
Closed
Closed
Changes from 5 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
1bd34d6
Add only_protected_branches in data source github_repository (#1162)
bpaquet 5f1a989
Remove mistakenly committed binary (#1223)
kfcampbell ce4c046
Revert PR #1162 (#1224)
kfcampbell 420a34d
Revert "Revert PR #1162 (#1224)"
f419d7a
find correct permission
82cd6da
fix: remove dead code
10af5f2
Replaying the changes in #1162 without the binary (#1234)
kfcampbell d544bbc
Revert 754d73f66bd3b5da49d5f3e0714a4186d40d0377 (#1235)
kfcampbell 942e965
Add default binary name to .gitignore (#1237)
kfcampbell b732b01
Add note deprecating changelog (#1254)
kfcampbell 86e4b44
Switch to Go1.19 in CI check (#1256)
kfcampbell 6b9e025
Create data source for external groups (#1185)
kfcampbell 2c15b55
Support github_team_members role edits (#1216)
csainty 772c71b
Add membership_type to data.github_team (#1242)
bpaquet b60a8af
Bump go-github to v46.0.0 (#1258)
gesellix c753688
feat(github_ip_ranges): support for Web and API IP Ranges (#1220)
Jamian cb52c61
Bump go-github to v47 (#1269)
kfcampbell cbb3d7e
Add support for default merge commit params (#1263)
garrettheel 1f14bb2
Bump to v1.17.2 (#1272)
kfcampbell 6119318
Bump non-Terraform dependencies. (#1274)
kfcampbell dbda9b9
Refactor out branches attribute to new data source (#1117)
k24dizzle 91e9a78
[Feature] New datasource github_repository_teams (#1244)
bpaquet 0b103e6
Small README cleanup (#1282)
kfcampbell 6fb72e3
Small issue docs fix (#1285)
kfcampbell 0ba3d4b
Initial commit of bumping version number to v5 (#1288)
kfcampbell ce9a54a
Feature github_repository_tag_protection closes#1250 (#1283)
kuhlman-labs 9e522d6
[Feature] Add data source to read secrets (#1245)
bpaquet 06054eb
Remove scripts/changelog-links.sh (#1291)
kfcampbell fcef86f
Remove gogetcookie.sh (#1292)
kfcampbell 3724f74
Set `node_id` in `github_organization` data source (#1277)
douglascayers aaf1a88
Create data source for organization ip allow list (#1275)
douglascayers 759426b
Adding resource github_organization_settings to provider closes#1125 …
kuhlman-labs 6773d80
Allow to get only protected on non protected branch with github_repos…
bpaquet 9d58e1d
Fix `github_repository_file`: Disable default compute of author and e…
pawnu 553785b
feat(branch-protection): Push/Reviewer actors can be specified by nam…
dion-gionet 25f682b
fix: `github_dependabot_organization_secret` panic (#1323)
nikolay ae05952
Fix doc of github_dependabot_secrets (#1297)
bpaquet 2b22c64
Lowercase error strings (#1329)
kfcampbell 0080e4a
Add datasource: github_repository_deploy_keys (#1299)
bpaquet ad2193c
Add data source organization webhooks and repository webhooks (#1300)
bpaquet 05a8875
Revert PR #1020 to undo performance regression as reported in #1328 (…
kfcampbell f3640e6
Update github_organization_settings to only need RO permissions at pl…
avgalani 3083e4c
Initial commit of advice about searching for prior work in repo befor…
kfcampbell 7dfb5d2
Suppress plan diff when github_repository changes to archived (#1326)
kangaechu 156b7ea
fix(branch-protection): Use more efficient function to fetch actors (…
dion-gionet 49795e1
feat: allow_update_branch argument (#1143)
strantalis 27ed4c2
Correct docs to match code state (#1346)
kfcampbell 13e9384
Create data source for github app (#1268)
g-chouzadjian abe26d0
Bump go-github to v48 (#1347)
kfcampbell 99dd636
Add support for a summary view of org teams. (#1176)
david-bain f7da074
Add support for repository alphanumeric autolinks (Fixes #1270) (#1314)
douglascayers 76bcc17
Merge branch 'main' into custom-roles
nickfloyd 6bbcfdd
Initial commit of standardized templates
kfcampbell 690a093
[maint] Add standardized issue templates
nickfloyd bbc334c
feat: closes #862 by adding a state attribute for the state of the in…
wwsean08 ffd6f0a
Add release assets (#1195)
shabbyrobe 1b851ad
Include All Branches in template repositories (#1353)
kfcampbell baafae0
Fix asserts_url typo (#1194)
shabbyrobe fc51853
new resource: github_actions_repository_permissions (#1339)
fatmcgav-depop c2d19be
feat: add pull_request_template.md PR template (#1354)
nickfloyd 0602774
Add only_protected_branches in data source github_repository (#1162)
bpaquet 5cd82f6
Remove mistakenly committed binary (#1223)
kfcampbell 3c93cdb
find correct permission
10c5bc9
fix: remove dead code
d212ebf
Revert "Revert PR #1162 (#1224)"
ac9e797
Merge branch 'custom-roles' of github.com:joshua-hancox/terraform-pro…
nickfloyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,20 @@ | ||
package github | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/google/go-github/v45/github" | ||
) | ||
|
||
const ( | ||
pullPermission string = "pull" | ||
triagePermission string = "triage" | ||
pushPermission string = "push" | ||
maintainPermission string = "maintain" | ||
adminPermission string = "admin" | ||
writePermission string = "write" | ||
readPermission string = "read" | ||
pullPermission string = "pull" | ||
pushPermission string = "push" | ||
writePermission string = "write" | ||
readPermission string = "read" | ||
) | ||
|
||
func getInvitationPermission(i *github.RepositoryInvitation) (string, error) { | ||
func getInvitationPermission(permission string) string { | ||
// Permissions for some GitHub API routes are expressed as "read", | ||
// "write", and "admin"; in other places, they are expressed as "pull", | ||
// "push", and "admin". | ||
permissions := i.GetPermissions() | ||
if permissions == readPermission { | ||
return pullPermission, nil | ||
} else if permissions == writePermission { | ||
return pushPermission, nil | ||
} else if permissions == adminPermission { | ||
return adminPermission, nil | ||
} else if *i.Permissions == maintainPermission { | ||
return maintainPermission, nil | ||
} else if *i.Permissions == triagePermission { | ||
return triagePermission, nil | ||
if permission == readPermission { | ||
return pullPermission | ||
} else if permission == writePermission { | ||
return pushPermission | ||
} | ||
|
||
return "", fmt.Errorf("unexpected permission value: %v", permissions) | ||
return permission | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The addition of this
ValidateFunc
means that custom roles can no longer be used, correct?