Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove bash function #438

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 8 additions & 34 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,11 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
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})
}
cd preview
clean_up
export INPUT=$(gh pr list --json headRefName --jq '.[].headRefName')
for BRANCH in ${INPUT}; do
rm -rf $(echo ${BRANCH} | sha256sum | cut -c -10)
done
git add .
git commit -m"Remove preview artifacts"
git push
Expand Down Expand Up @@ -72,24 +59,11 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
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})
}
cd testnet
clean_up
export INPUT=$(gh pr list --json headRefName --jq '.[].headRefName')
for BRANCH in ${INPUT}; do
rm -rf $(echo ${BRANCH} | sha256sum | cut -c -10)
done
git add .
git commit -m"Remove testnet artifacts"
git push
Loading