feat(endorsement-system): Store ownername #13880
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: PR close | |
on: | |
pull_request: | |
types: | |
- closed | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
cleanup: | |
name: Clean up feature deployment | |
runs-on: ec2-runners | |
container: | |
image: public.ecr.aws/m3u4c4h9/island-is/actions-runner-public:latest | |
steps: | |
- name: Get git branch | |
run: | | |
set -euo pipefail | |
GIT_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF/refs\/heads\//}}" | |
echo "GIT_BRANCH=$GIT_BRANCH" >> "$GITHUB_ENV" | |
- name: Generate deployment branch name | |
id: git-branch-deploy | |
run: | | |
set -euo pipefail | |
GIT_BRANCH_DEPLOY="$GIT_BRANCH" | |
if [[ ! ("$GIT_BRANCH_DEPLOY" =~ "feature/") ]]; then | |
# If event is pull request but branch is not prefixed with feature/ | |
GIT_BRANCH_DEPLOY=feature/$GIT_BRANCH_DEPLOY | |
fi | |
# Avoid too long resource names | |
GIT_BRANCH_DEPLOY="${GIT_BRANCH_DEPLOY:0:50}" | |
echo "GIT_BRANCH_DEPLOY=$GIT_BRANCH_DEPLOY" >> "$GITHUB_ENV" | |
- name: Clean up feature | |
env: | |
SPINNAKER_WEBHOOK_TOKEN: ${{ secrets.SPINNAKER_WEBHOOK_TOKEN }} | |
SPINNAKER_URL: https://spinnaker-gate.shared.devland.is | |
run: | | |
set -euo pipefail | |
curl "$SPINNAKER_URL/webhooks/webhook/feature-cleanup" -H "content-type: application/json" --data-binary @- <<BODY | |
{ | |
"token": "$SPINNAKER_WEBHOOK_TOKEN", | |
"parameters": { | |
"feature_name": "$(echo "$GIT_BRANCH_DEPLOY" | cut -d"/" -f2- | tr -cd '[:alnum:]-' | tr '[:upper:]' '[:lower:]' | cut -c1-50)" | |
} | |
} | |
BODY |