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

Unable to Expand Org Team #55

Closed
gthomson31 opened this issue Nov 1, 2022 · 5 comments · Fixed by #60
Closed

Unable to Expand Org Team #55

gthomson31 opened this issue Nov 1, 2022 · 5 comments · Fixed by #60
Labels
bug Something isn't working

Comments

@gthomson31
Copy link

Hi There

Currently utilising this action within a new pipeline and have ran into the following issue.
This works when using individual org users but not team names.

      - name: Generate Approval token
        id: generate_token
        uses: tibdex/github-app-token@v1
        with:
          app_id: ${{ secrets.GLOBAL_WORKFLOW_APPROVAL_APP_ID }}
          private_key: ${{ secrets.GLOBAL_WORKFLOW_APPROVAL_APP_PRIVATE_KEY }}

      - name: Wait for execution approval
        id: procceed-with-execution-of-aws-sandbox-nuke
        uses: trstringer/manual-approval@v1
        with:
          secret: ${{ steps.generate_token.outputs.token }}
          approvers: ${{ env.GITHUB_TEAM_NAME }}
          minimum-approvals: 1
          issue-title: "${{ github.action }}" # optional - default is "Manual Approval"
Attempting to expand user snowplow-devops/com.snowplowanalytics.engineeringproductivity as a group (may not succeed)
GET https://api.github.com/orgs/snowplow-devops/teams/com.snowplowanalytics.engineeringproductivity/members: 404 Not Found []
Creating issue in repo snowplow-devops/engineering-productivity with the following content:
Title: Manual approval required for workflow run 3368332814: procceed-with-execution-of-aws-sandbox-nuke

Any help appreciated!

@trstringer
Copy link
Owner

Hmm that's really interesting. Can you use the GitHub CLI and make the following request?

$ gh api -H "Accept: application/vnd.github+json" /orgs/snowplow-devops/teams/com.snowplowanalytics.engineeringproductivity/members

Does that succeed, or do you get a 404 from that as well?

@kdesao-devops
Copy link

Hey +1 !
It appears that this block doesn't work anymore for my app either :/.

Hmm that's really interesting. Can you use the GitHub CLI and make the following request?

$ gh api -H "Accept: application/vnd.github+json" /orgs/snowplow-devops/teams/com.snowplowanalytics.engineeringproductivity/members

Does that succeed, or do you get a 404 from that as well?

I've changed to match my config and I have the same 404 that my Github action failed on.
Probably an update on the GitHub API ?

@gthomson31
Copy link
Author

gthomson31 commented Nov 11, 2022

Hey ,

So I have cracked the issue its down to how Github handles certain characters in names

When you have a team name containing "." these are replaced with "-" in the team name Slug

"name": "com.snowplowanalytics.engineeringproductivity",
"slug": "com-snowplowanalytics-engineeringproductivity",

by updating the team name slug to show the following the issue is now resolved

      - name: Wait for execution approval
        id: procceed-with-execution-of-sandbox-nuke
        uses: trstringer/manual-approval@v1
        with:
          secret: ${{ steps.generate_token.outputs.token }}
          approvers: com-snowplowanalytics-engineeringproductivity
          minimum-approvals: 1
          issue-title: "${{ github.action }}" # optional - default is "Manual Approval"

@gthomson31
Copy link
Author

Works perfect now just went through a test run 👍🏻

@trstringer
Copy link
Owner

Wow that's really interesting, I didn't know that. I'm going to reopen this, I think this behavior isn't intuitive so this action should handle this without the user having to know this behavior.

@trstringer trstringer reopened this Nov 11, 2022
@trstringer trstringer added bug Something isn't working and removed troubleshooting labels Nov 11, 2022
trstringer added a commit that referenced this issue Nov 11, 2022
Currently if you have an org team name with a period in it, the team will not be found with a 404 response. This is because the GitHub API requires that the periods are replaced with hyphens. This PR fixes this behavior and closes #55.

Signed-off-by: Thomas Stringer <thomas@trstringer.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants