DEVX-1608 added csp for emoji, also updated redirect for API guidelines #82
Workflow file for this run
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 gitops deployment branch | |
on: | |
pull_request: | |
types: [unlabeled, closed] | |
branches: ['main'] | |
env: | |
HUSKY: 0 | |
# save resources. Don't take up a queue space doing a duplicate build | |
concurrency: | |
group: delete-${{ github.event.pull_request.number }} | |
cancel-in-progress: true | |
jobs: | |
should-run: | |
runs-on: ubuntu-latest | |
outputs: | |
SHOULD_RUN: ${{ steps.should_run.outputs.SHOULD_RUN }} | |
steps: | |
- name: Check if this workflow should run | |
id: should_run | |
run: | | |
does_closed_pr_have_preview_label=${{ github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'preview') }} | |
was_preview_label_removed=${{ github.event.action == 'unlabeled' && github.event.label.name == 'preview' }} | |
should_run=false | |
if $does_closed_pr_have_preview_label || $was_preview_label_removed ; then | |
should_run=true | |
fi | |
echo "SHOULD_RUN=$should_run" >> "$GITHUB_OUTPUT" | |
get-pr-branch-name: | |
needs: should-run | |
if: needs.should-run.outputs.SHOULD_RUN == 'true' | |
uses: ./.github/workflows/get-pr-branch-name.yaml | |
delete-gitops-branch: | |
runs-on: ubuntu-latest | |
needs: [get-pr-branch-name, should-run] | |
if: needs.should-run.outputs.SHOULD_RUN == 'true' | |
steps: | |
- name: Setup gitops repo access | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }} | |
- name: Checkout CD repo | |
uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }} | |
repository: ${{ secrets.MANIFEST_REPO }} | |
fetch-depth: 0 # get all branches. Needed for deleting gitops branch | |
- name: Delete branch in gitops | |
run: | | |
if git rev-parse --verify --quiet origin/${{ needs.get-pr-branch-name.outputs.BRANCH_NAME }}; then | |
git push origin --delete ${{ needs.get-pr-branch-name.outputs.BRANCH_NAME }} | |
else | |
echo "Branch ${{ needs.get-pr-branch-name.outputs.BRANCH_NAME }} already does not exist" | |
fi |