fix(vhost-install): remove identifier normalization, align validation with RAND_CHAR sources, harden SQL credential handling #166
Workflow file for this run
This file contains hidden or 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
| # This workflow automatically deletes the branch associated with a pull request | |
| # after it has been merged, unless the branch is protected (e.g., main, dev, staging). | |
| # It helps keep the repository clean by removing merged feature or bugfix branches. | |
| name: Branch Cleanup | |
| on: | |
| pull_request: | |
| types: [closed] | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| jobs: | |
| cleanup: | |
| if: github.event.pull_request.merged == true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Delete merged branch | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const protectedPattern = /^(main|master|dev|develop|staging|production)$/; | |
| const pullRequest = context.payload.pull_request; | |
| const branchName = pullRequest.head.ref; | |
| const sourceRepo = pullRequest.head.repo.full_name; | |
| const targetRepo = `${context.repo.owner}/${context.repo.repo}`; | |
| core.info(`Checking branch: ${branchName}`); | |
| if (protectedPattern.test(branchName)) { | |
| core.warning(`Skipping deletion of protected branch: ${branchName}`); | |
| return; | |
| } | |
| if (sourceRepo !== targetRepo) { | |
| core.notice(`Skipping deletion for fork branch ${sourceRepo}:${branchName}`); | |
| return; | |
| } | |
| try { | |
| await github.rest.git.deleteRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: `heads/${branchName}` | |
| }); | |
| core.notice(`Successfully deleted branch: ${branchName}`); | |
| } catch (error) { | |
| if (error.status === 404 || error.status === 422) { | |
| core.warning(`Branch already deleted or unavailable: ${branchName}`); | |
| return; | |
| } | |
| throw error; | |
| } |