Update GH action runners for lightweight workflows #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |