Skip to content

Commit ad95d6b

Browse files
committed
WIP: add job to whitelist users
1 parent 01f4750 commit ad95d6b

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Check membership
2+
3+
on:
4+
push:
5+
branches:
6+
- julio/publising/add-job-to-whitelist-crate-releases
7+
workflow_dispatch:
8+
# pull_request:
9+
# types: [opened, edited]
10+
jobs:
11+
get-token:
12+
name: read contents of another repo
13+
runs-on: ubuntu-latest
14+
permissions:
15+
id-token: write # Needed to federate tokens.
16+
outputs:
17+
sts_token: ${{ steps.octo-sts.outputs.token }}
18+
steps:
19+
- uses: DataDog/dd-octo-sts-action@08f2144903ced3254a3dafec2592563409ba2aa0 # v1.0.1
20+
id: octo-sts
21+
with:
22+
scope: DataDog/libdatadog # target repository
23+
policy: YOUR_POLICY # trust policy in target repo, without the .sts.yaml extension
24+
- name: Use GH token
25+
run: |
26+
gh auth status
27+
gh repo list --visibility=internal DataDog
28+
env:
29+
GH_TOKEN: ${{ steps.octo-sts.outputs.token }}
30+
GH_PAGER: cat # (unrelated) needed to disable paging of gh cli
31+
32+
check-membership:
33+
runs-on: ubuntu-latest
34+
needs: get-token
35+
steps:
36+
- name: Check if user is in the team allowed to make crate releases
37+
id: check
38+
uses: TheModdingInquisition/actions-team-membership@057d91bb80f2976a1bc6dfab5b4ae1da9aebbd89 #v1.0.1
39+
with:
40+
team: 'libdatadog-owners'
41+
organization: 'Datadog'
42+
token: ${{ needs.get-token.outputs.sts_token }} # Needs 'read:org' scope
43+
exit: false
44+
45+
- name: Check output
46+
run: |
47+
echo "User is permitted: ${{ steps.check.outputs.permitted }}"
48+
echo "Teams: ${{ steps.check.outputs.teams }}"
49+

0 commit comments

Comments
 (0)