-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (39 loc) · 1.79 KB
/
update_shortnames.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
name: Update Shortnames for all PRs
on:
workflow_dispatch:
# schedule:
# - cron: '00 5 * * *'
jobs:
update_shortnames:
runs-on: ubuntu-latest
name: Update shortnames for PRs without shortnames
steps:
- uses: getsentry/action-github-app-token@v2
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
with:
token: ${{ steps.podaac-cicd.outputs.token }}
- name: retrieve list of open PRs
env:
GH_TOKEN: ${{ steps.podaac-cicd.outputs.token }}
run: |
curl "https://cmr.earthdata.nasa.gov/search/collections.umm_json?service_name=PODAAC%20L2%20Cloud%20Subsetter&page_size=2000&token=${{ secrets.LAUNCHPAD_TOKEN_OPS }}" >cmr_metadata.json
gh pr list --state open --label autotest --limit 500 >branches.list
cat branches.list|grep diff\/ |sed 's|^.*diff/|diff/|g' |sed 's|\t.*||g' >branches2.list
ls -al
while read prname; do
echo "$prname"
COLLECTION_ID=$(echo $prname |sed -E 's/diff\/[uatops]+\///')
COMMAND="cat cmr_metadata.json | jq -r '.items[] | select(.meta."concept-id" == "$COLLECTION_ID")' |jq -r '.umm.ShortName"
echo "COMMAND: $COMMAND"
SHORT_NAME=$($COMMAND)
echo "SHORT_NAME=$SHORT_NAME"
done <branches2.list
# COLLECTION_ID=$(echo ${{ github.event.pull_request.title }} |sed -E 's/[A-Z+] //' |sed -E 's/ \(.*//' )
# cd $GITHUB_WORKSPACE
# SHORT_NAME=$(cat cmr_metadata.json | jq -r '.items[] | select(.meta."concept-id" == "$COLLECTION_ID")' |jq -r '.umm.ShortName')
# echo "SHORT_NAME=$SHORT_NAME">>$GITHUB_ENV