-
Notifications
You must be signed in to change notification settings - Fork 1.7k
chore(ci): Use GitHub App token for team membership rather than user PAT #17936
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
Merged
jszwedko
merged 5 commits into
master
from
jszwedko/use-ci-app-token-for-team-membership
Jul 11, 2023
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
93c0e7f
chore(ci): Use GitHub App token for team membership rather than user PAT
jszwedko a978932
trigger int tests
jszwedko fd9be80
test in another workflow
jszwedko 78ca360
remove test steps
jszwedko e7cb0d4
Didn't mean to replace GH_PROJECT_PAT usage
jszwedko 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -13,17 +13,23 @@ jobs: | |
runs-on: ubuntu-latest | ||
if: ${{ github.actor != 'dependabot[bot]' }} | ||
steps: | ||
- name: Generate authentication token | ||
id: generate_token | ||
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | ||
with: | ||
app_id: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }} | ||
private_key: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_PRIVATE_KEY }} | ||
- uses: tspascoal/get-user-teams-membership@v2 | ||
id: checkVectorMember | ||
with: | ||
username: ${{ github.actor }} | ||
team: vector | ||
GITHUB_TOKEN: ${{ secrets.GH_PAT_ORG }} | ||
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
- uses: actions/[email protected] | ||
if: ${{ steps.checkVectorMember.outputs.isTeamMember == 'false' }} | ||
with: | ||
project-url: https://github.com/orgs/vectordotdev/projects/49 | ||
github-token: ${{ secrets.GH_PROJECT_PAT }} | ||
github-token: ${{ steps.generate_token.outputs.token }} | ||
add-dependabot-to-project: | ||
name: Add dependabot PR to Gardener project board | ||
runs-on: ubuntu-latest | ||
|
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -98,9 +98,9 @@ jobs: | |
- name: Determine if secrets are defined (PR author is team member). | ||
if: github.event_name == 'pull_request' | ||
env: | ||
GH_PAT_ORG: ${{ secrets.GH_PAT_ORG }} | ||
GH_APP_DATADOG_VECTOR_CI_APP_ID: ${{ secrets.GH_APP_DATADOG_VECTOR_CI_APP_ID }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 was going to mention this 🙂 |
||
run: | | ||
if [[ "$GH_PAT_ORG" != "" ]] ; then | ||
if [[ "$GH_APP_DATADOG_VECTOR_CI_APP_ID" != "" ]] ; then | ||
echo "PR_HAS_ACCESS_TO_SECRETS=true" >> "$GITHUB_ENV" | ||
else | ||
echo "PR_HAS_ACCESS_TO_SECRETS=false" >> "$GITHUB_ENV" | ||
|
This file contains hidden or 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.
Nice!
A potential future enhancement- we could drop this into a re-usable workflow, and have the token be an output of it, since we do it in a few places.
Could even have an optional parameter to that workflow to do the team membership check, which would populate an output as well, so we wouldn't have to repeat these two job steps throughout.