Skip to content

Commit c386e79

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

File tree

1 file changed

+47
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)