Skip to content

Commit

Permalink
fix clean up script (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianscatularo authored Sep 20, 2023
1 parent 4a82be4 commit 910af4c
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,26 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
clean_up() {
shopt -s extglob
INPUT=$(gh pr list --json headRefName --jq '.[].headRefName')
OUTPUT="clean.sh"
# Loop through the array and concatenate the strings with pipe character
for BRANCH in ${INPUT}; do
HASH=$(echo ${BRANCH} | sha256sum | cut -c -10)
if [ -n "${OUTPUT}" ]; then
OUTPUT="${OUTPUT}|${HASH}"
else
OUTPUT="${HASH}"
fi
done
echo "Hashes to remove ${OUTPUT}"
rm -rf !(${OUTPUT})
}
npm run unpublish ${_BRANCH_NAME_SHA}
git add ${_BRANCH_NAME_SHA}
cd preview
clean_up
git add .
git commit -m"Remove preview artifacts"
git push
Expand All @@ -53,7 +71,25 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
clean_up() {
shopt -s extglob
INPUT=$(gh pr list --json headRefName --jq '.[].headRefName')
OUTPUT="clean.sh"
# Loop through the array and concatenate the strings with pipe character
for BRANCH in ${INPUT}; do
HASH=$(echo ${BRANCH} | sha256sum | cut -c -10)
if [ -n "${OUTPUT}" ]; then
OUTPUT="${OUTPUT}|${HASH}"
else
OUTPUT="${HASH}"
fi
done
echo "Hashes to remove ${OUTPUT}"
rm -rf !(${OUTPUT})
}
npm run unpublish ${_BRANCH_NAME_SHA}
git add ${_BRANCH_NAME_SHA}
cd testnet
clean_up
git add .
git commit -m"Remove testnet artifacts"
git push

0 comments on commit 910af4c

Please sign in to comment.