forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (52 loc) · 2.42 KB
/
community-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: Community Check
on:
workflow_call:
inputs:
username:
description: The username to check the association of
type: string
required: true
outputs:
core_contributor:
description: Whether or not the user is a core contributor
value: ${{ jobs.community_check.outputs.is_core_contributor }}
maintainer:
description: Whether or not the user is a maintainer
value: ${{ jobs.community_check.outputs.is_maintainer }}
partner:
description: Whether or not the user is a partner
value: ${{ jobs.community_check.outputs.is_partner }}
jobs:
community_check:
name: Check community lists for username
runs-on: ubuntu-latest
outputs:
is_core_contributor: ${{ steps.determination.outputs.is_core_contributor }}
is_maintainer: ${{ steps.determination.outputs.is_maintainer }}
is_partner: ${{ steps.determination.outputs.is_partner }}
steps:
- name: Decode user lists from secrets
id: decode
env:
CORE_CONTRIBUTORS: ${{ secrets.CORE_CONTRIBUTORS }}
MAINTAINERS: ${{ secrets.MAINTAINERS }}
PARTNERS: ${{ secrets.PARTNERS }}
run: |
# Create shell variables to hold decoded values
CORE_CONTRIBUTORS_DECODED=$(echo $CORE_CONTRIBUTORS | base64 -d | jq '. | tojson')
MAINTAINERS_DECODED=$(echo $MAINTAINERS | base64 -d | jq '. | tojson')
PARTNERS_DECODED=$(echo $PARTNERS | base64 -d | jq '. | tojson')
# Mask the variables so the values aren't exposed
echo "::add-mask::$CORE_CONTRIBUTORS_DECODED"
echo "::add-mask::$MAINTAINERS_DECODED"
echo "::add-mask::$PARTNERS_DECODED"
# Set outputs
echo "core_contributors_list=$CORE_CONTRIBUTORS_DECODED" >> $GITHUB_OUTPUT
echo "maintainers_list=$MAINTAINERS_DECODED" >> $GITHUB_OUTPUT
echo "partners_list=$PARTNERS_DECODED" >> $GITHUB_OUTPUT
- name: Determine if user is in lists
id: determination
run: |
echo "is_core_contributor="${{ contains(fromJSON(steps.decode.outputs.core_contributors_list), inputs.username) }} >> $GITHUB_OUTPUT
echo "is_maintainer="${{ contains(fromJSON(steps.decode.outputs.maintainers_list), inputs.username) }} >> $GITHUB_OUTPUT
echo "is_partner="${{ contains(fromJSON(steps.decode.outputs.partners_list), inputs.username) }} >> $GITHUB_OUTPUT