Skip to content

fix: intermittent csv export with hashes bug #1655 #182

fix: intermittent csv export with hashes bug #1655

fix: intermittent csv export with hashes bug #1655 #182

name: Manual branch test teardown
on:
pull_request_target:
types: [closed]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
teardown:
name: Seek & Destroy
runs-on: ubuntu-latest
# TODO: if pr contains label "has-test-bin"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
- name: Seek
id: seek
run: |
TAG_VERSION="$(echo '${{ github.head_ref }}' | iconv -t ascii//TRANSLIT | sed -r "s/[^a-zA-Z0-9]+/-/g" | sed -r "s/^-+\|-+$//g" | tr A-Z a-z)"
TAG_VERSION="v$(awk '/version/{gsub(/("|",)/,"",$2);print $2}' package.json)-$TAG_VERSION.0"
echo ::set-output name=tag-version::$TAG_VERSION
- name: Destroy local
id: destroy-local
run: |
git fetch --tags -p
set -e
TAG_NOT_FOUND=0
git tag -d '${{ steps.seek.outputs.tag-version }}' || TAG_NOT_FOUND=1
echo ::set-output name=tag-not-found::$TAG_NOT_FOUND
- name: Destroy remote
if: ${{ steps.destroy-local.outputs.tag-not-found == 0 }}
run: |
(
gh release delete "$TAG_VERSION" --yes --repo $REPO &&
git push --delete origin "$TAG_VERSION" &&
gh pr comment $PR_NUMBER --body "$TAG_VERSION successfully destroyed! ($RUN_URL)" --repo $REPO
) || gh pr comment $PR_NUMBER --body "$TAG_VERSION deletion failed ($RUN_URL)" --repo $REPO
env:
REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.number }}
TAG_VERSION: ${{ steps.seek.outputs.tag-version }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.run_id }}