-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c97d724
commit e4e9767
Showing
5 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Example Deployment | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: devopsmakers/pr-name-generator-action@v0.0.1 | ||
id: generator | ||
- run: echo "Deploying ${{ steps.generator.outputs.name }}" | ||
- name: Comment with link | ||
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }} | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: | | ||
Congratualations! You can access your PR environment at: | ||
https://${{ steps.generator.outputs.name }}.example.com/ | ||
reactions: 'tada' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Example Destroy | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
- master | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: devopsmakers/pr-name-generator-action@v0.0.1 | ||
id: generator | ||
- run: echo "Destroying ${{ steps.generator.outputs.name }}" | ||
- name: Create comment | ||
uses: peter-evans/create-or-update-comment@v2 | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: | | ||
Ephemeral environment: `${{ steps.generator.outputs.name }}` has been destroyed. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# pr-name-generator-action | ||
A Github action to create consistent names for PR based environments. | ||
A Github action to create consistent, unique names for PR based environments. | ||
|
||
Uses: [unique-names-generator](https://github.com/andreasonny83/unique-names-generator) | ||
and a "seed" based on the repo owner, name and issue (PR) number to generate a | ||
unique and consistent name. This makes it easy to deploy and clean up ephemaral | ||
environments on PR open, close or merge without needing to keep track of a | ||
non-deterministic unique name. | ||
|
||
## Inputs | ||
None. | ||
|
||
## Outputs | ||
### `name` | ||
The generated unique and consistent name | ||
|
||
## Example Usage | ||
See: | ||
- [example_deploy.yml](https://github.com/devopsmakers/pr-name-generator-action/blob/main/.github/workflows/example_deploy.yml) | ||
- [example_destroy.yml](https://github.com/devopsmakers/pr-name-generator-action/blob/main/.github/workflows/example_destroy.yml) |
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
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