forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (46 loc) · 2.21 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
name: Community Check
on:
workflow_call:
outputs:
core_contributor:
value: ${{ jobs.community_check.outputs.is_core_contributor }}
maintainer:
value: ${{ jobs.community_check.outputs.is_maintainer }}
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
env:
USER_LOGIN: ${{ github.event.issue.user.login || github.event.pull_request.user.login }}
run: |
echo "is_core_contributor="${{ contains(fromJSON(steps.decode.outputs.core_contributors_list), env.USER_LOGIN) }} >> $GITHUB_OUTPUT
echo "is_maintainer="${{ contains(fromJSON(steps.decode.outputs.maintainers_list), env.USER_LOGIN) }} >> $GITHUB_OUTPUT
echo "is_partner="${{ contains(fromJSON(steps.decode.outputs.partners_list), env.USER_LOGIN) }} >> $GITHUB_OUTPUT