-
Notifications
You must be signed in to change notification settings - Fork 1
41 lines (38 loc) · 1.34 KB
/
ips.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
name: "Handle Allowed IPs"
on:
workflow_dispatch:
push:
branches:
- 'ip-develop'
jobs:
handle_allowed_ips:
name: "Handle Allowed IPs"
runs-on: ubuntu-latest
outputs:
ips: ${{ steps.parseIps.outputs.ips }}
steps:
- name: "Checkout"
# @see https://github.com/actions/checkout
uses: actions/checkout@v4
# with:
# repository: 'ministryofjustice/moj-ip-addresses'
# ref: 'main'
# # This is a fine grained PAT, it's scoped to the moj-ip private repository
# # with the single permission: Content: Read-only.
# # The token is pending approval: https://github.com/settings/personal-access-tokens/3669004
# token: ${{ secrets.MOJ_IP_ADDRESSES_RO_PAT }}
- name: "Parse IPs"
id: parseIps
uses: mikefarah/yq@master
with:
cmd: |
IPS=$(yq 'explode(.) | {"deprecating": .deprecating_access_to_moj_intranet | flatten, "allow": .allow_access_to_moj_intranet | flatten }' -o json -I=0 deploy/config/example-moj-ips.yaml)
echo ::add-mask::$IPS
echo "ips=$IPS" >> $GITHUB_OUTPUT
- name: Reuse a variable obtained in another step
run: |
echo $IPS
size=${#IPS}
echo $size
env:
IPS: ${{ needs.parseIps.outputs.ips }}