Skip to content

Update GH action runners for lightweight workflows #24

Update GH action runners for lightweight workflows

Update GH action runners for lightweight workflows #24

Workflow file for this run

name: Delete docs branch
on:
workflow_call:
push:
branches:
- main
permissions: write-all
jobs:
delete-docs-branch:
runs-on: thevickypedia-lite
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Delete 'docs' branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="docs"
REPO="https://api.github.com/repos/${{ github.repository }}"
# Check if the branch exists
STATUS=$(curl -o /dev/null -s -w "%{http_code}\n" \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"$REPO/branches/$BRANCH_NAME")
if [ $STATUS -eq 200 ]; then
# Branch exists, delete it
curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"$REPO/git/refs/heads/$BRANCH_NAME"
echo "::notice title=Status::Branch '$BRANCH_NAME' has been deleted."
else
echo "::notice title=Status::Branch '$BRANCH_NAME' does not exist."
fi
shell: bash