-
Notifications
You must be signed in to change notification settings - Fork 12
Add PR Preview actions #381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mikehosmar
wants to merge
13
commits into
development
Choose a base branch
from
mh/wip/preview-test
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
96feddc
add preview action
mikehosmar 3a52609
add close action
mikehosmar c5f1888
unneeded env
mikehosmar 920d085
use same action as PR open action
mikehosmar a0b3fba
EOF new lines
mikehosmar 725804e
add action to add new rc-branches
mikehosmar e8762ce
EOF
mikehosmar 6c574bb
allow failure of branch removal
mikehosmar 71aac79
Remove Pull-request trigger
mikehosmar 9b72654
don't allow failure for rc branches
mikehosmar 4ea4f24
use correct ref for create event
mikehosmar 76a1784
Add token permission
mikehosmar dc47123
Fix filter for rc branches.
mikehosmar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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: | ||
- name: configure AWS credentials | ||
id: creds | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | ||
output-credentials: true | ||
- name: cleanup PR preview branch | ||
uses: mikehosmar/amplify-preview-actions@sed-replace-all | ||
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-2' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Amplify Preview Enable | ||
|
||
on: | ||
create: | ||
delete: | ||
|
||
jobs: | ||
deploy-on-create: | ||
if: github.event_name == 'create' && startsWith(github.event.ref, 'rc/') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: configure AWS credentials | ||
id: creds | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | ||
output-credentials: true | ||
- name: Enable Amplify Preview | ||
uses: mikehosmar/amplify-preview-actions@sed-replace-all | ||
with: | ||
branch_name: ${{ github.event.ref }} | ||
amplify_command: deploy | ||
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 }} | ||
EnablePreview: true | ||
AWS_REGION: 'us-east-2' | ||
|
||
cleanup-on-delete: | ||
if: github.event_name == 'delete' && (startsWith(github.event.ref, 'rc/') || startsWith(github.head_ref, 'rc/')) | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Get ref for pull_request | ||
run: | | ||
echo "BRANCH_NAME=${{ github.head_ref }}" >> $GITHUB_ENV | ||
if: github.event_name == 'pull_request_target' | ||
- name: Get ref for delete | ||
run: | | ||
echo "BRANCH_NAME=${{ github.event.ref }}" >> $GITHUB_ENV | ||
if: github.event_name == 'delete' | ||
- name: configure AWS credentials | ||
id: creds | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | ||
output-credentials: true | ||
- name: cleanup PR preview branch | ||
uses: mikehosmar/amplify-preview-actions@sed-replace-all | ||
with: | ||
branch_name: ${{ env.BRANCH_NAME }} | ||
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-2' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Amplify Preview | ||
|
||
on: | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
deploy: | ||
if: contains(github.event.label.name, 'Preview Environment') | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
permissions: | ||
id-token: write | ||
pull-requests: write | ||
steps: | ||
- name: configure AWS credentials | ||
id: creds | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-region: us-east-2 | ||
role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }} | ||
output-credentials: true | ||
- name: deploy PR preview | ||
uses: mikehosmar/amplify-preview-actions@sed-replace-all | ||
with: | ||
branch_name: ${{ github.head_ref }} | ||
amplify_command: deploy | ||
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-2' | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you elaborate on what this dependency is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an action which contains the amplify commands to create and close branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just meant to highlight the "uses: mikehosmar/amplify-preview-actions@sed-replace-all" line. I wasn't sure if that was a link to something in your personal account somewhere and, if so, should we move it to a more accessible location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did Fork the action to my account to make sure we have a copy which we control. We could fork it to clearpathrobotics if you would like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would be preferable to fork to clearpathrobotics.