No-Jira - Re-enable Previews #1
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: 'Amplify PR Closed' | |
on: | |
pull_request_target: | |
types: [closed] | |
jobs: | |
delete: | |
permissions: | |
id-token: write | |
if: contains(github.event.pull_request.labels.*.name, 'Preview Environment') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: configure AWS credentials | |
id: creds | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: us-east-1 | |
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | |
output-credentials: true | |
- name: set branchname env | |
id: setbranchname | |
run: | | |
# use GITHUB_HEAD_REF that is set to PR source branch | |
echo "branch=$GITHUB_HEAD_REF" >> "$GITHUB_OUTPUT" | |
- name: cleanup PR preview branch | |
uses: yinlinchen/[email protected] | |
with: | |
branch_name: ${{ github.head_ref }} | |
amplify_command: delete | |
env: | |
AWS_ACCESS_KEY_ID: ${{ steps.creds.outputs.aws-access-key-id }} | |
AWS_SECRET_ACCESS_KEY: ${{ steps.creds.outputs.aws-secret-access-key }} | |
AmplifyAppId: ${{ secrets.AMPLIFY_APP_ID }} | |
AWS_REGION: 'us-east-1' |