Skip to content

Update Shortnames for all PRs #8

Update Shortnames for all PRs

Update Shortnames for all PRs #8

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]+\///')
SHORT_NAME=$(cat cmr_metadata.json | jq -r '.items[] | select(.meta."concept-id" == "$COLLECTION_ID")' |jq -r '.umm.ShortName')
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