-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (123 loc) · 5.32 KB
/
diff.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Run every third day starting from the 2nd of the month 1 am pacific
# check for new collection associations to the concise UMM-S record
# in UAT and OPS. If a new association is found, a PR is opened to add the new collection concept id to the
# cmr/concise/*_associations.txt file.
name: Scan For New Associations
on:
workflow_dispatch:
schedule:
- cron: '0 8 2-31/3 * *'
jobs:
find_new:
name: Find new associations
runs-on: ubuntu-latest
outputs:
new_uat_associations: ${{ steps.diff.outputs.new_uat_associations }}
new_ops_associations: ${{ steps.diff.outputs.new_ops_associations }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.5.1
- name: Run diff
id: diff
env:
UAT_TOKEN_TEMP: ${{ secrets.LAUNCHPAD_TOKEN_UAT }}
OPS_TOKEN_TEMP: ${{ secrets.LAUNCHPAD_TOKEN_OPS }}
run: |
poetry install
ls $GITHUB_WORKSPACE/tests/cmr/concise/uat/ > uat_associations.txt
ls $GITHUB_WORKSPACE/tests/cmr/concise/ops/ > ops_associations.txt
poetry run cmr_association_diff -e uat -t service -p POCLOUD -n 'PODAAC Concise' -a uat_associations.txt --token $UAT_TOKEN_TEMP > new_uat_associations.txt
poetry run cmr_association_diff -e ops -t service -p POCLOUD -n 'PODAAC Concise' -a ops_associations.txt --token $OPS_TOKEN_TEMP > new_ops_associations.txt
echo "new_uat_associations=$(poetry run python tests/collection_names.py --env uat --token $UAT_TOKEN_TEMP --file new_uat_associations.txt)" >> $GITHUB_OUTPUT
echo "new_ops_associations=$(poetry run python tests/collection_names.py --env ops --token $OPS_TOKEN_TEMP --file new_ops_associations.txt)" >> $GITHUB_OUTPUT
rm *_associations.txt
open_pr_uat:
needs: find_new
strategy:
fail-fast: false
max-parallel: 2
matrix:
data: ${{fromJson(needs.find_new.outputs.new_uat_associations)}}
runs-on: ubuntu-latest
name: UAT ${{ matrix.data.concept_id }} ${{ matrix.data.short_name }}
steps:
- uses: getsentry/action-github-app-token@v3
name: Get GH App token
id: podaac-cicd
with:
app_id: ${{ secrets.CICD_APP_ID }}
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
- name: Update uat_associations
run: |
mkdir -p $GITHUB_WORKSPACE/tests/cmr/concise/uat
echo "${{ matrix.data.concept_id }}" > $GITHUB_WORKSPACE/tests/cmr/concise/uat/${{ matrix.data.concept_id }}
- name: Create Pull Request for ${{ env.SHORT_NAME }}
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.podaac-cicd.outputs.token }}
commit-message: Add ${{ matrix.data.concept_id }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: diff/uat/${{ matrix.data.concept_id }}
delete-branch: true
title: UAT ${{ matrix.data.concept_id }} (${{ matrix.data.short_name }})
body: |
New association between concise and ${{ matrix.data.concept_id }} found in UAT.
Beginning verification of collection.
labels: |
unverified
autotest
- name: Enable Pull Request Automerge
env:
GH_TOKEN: ${{ github.token }}
run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}
open_pr_ops:
needs: find_new
strategy:
fail-fast: false
max-parallel: 2
matrix:
data: ${{fromJson(needs.find_new.outputs.new_ops_associations)}}
runs-on: ubuntu-latest
name: OPS ${{ matrix.data.concept_id }} ${{ matrix.data.short_name }}
steps:
- uses: getsentry/action-github-app-token@v3
name: Get GH App token
id: podaac-cicd
with:
app_id: ${{ secrets.CICD_APP_ID }}
private_key: ${{ secrets.CICD_APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
- name: Update ops_associations
run: |
mkdir -p $GITHUB_WORKSPACE/tests/cmr/concise/ops
echo "${{ matrix.data.concept_id }}" > $GITHUB_WORKSPACE/tests/cmr/concise/ops/${{ matrix.data.concept_id }}
- name: Create Pull Request for ${{ env.SHORT_NAME }}
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.podaac-cicd.outputs.token }}
commit-message: Add ${{ matrix.data.concept_id }}
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
branch: diff/ops/${{ matrix.data.concept_id }}
delete-branch: true
title: OPS ${{ matrix.data.concept_id }} (${{ matrix.data.short_name }})
body: |
New association between concise and ${{ matrix.data.concept_id }} found in OPS.
Beginning verification of collection.
labels: |
unverified
autotest
- name: Enable Pull Request Automerge
env:
GH_TOKEN: ${{ github.token }}
run: gh pr merge --merge --auto ${{ steps.cpr.outputs.pull-request-number }}