From 73fed71377f500e188a4aaa22f34acc5d24c4088 Mon Sep 17 00:00:00 2001 From: Julia March <101819212+juliamrch@users.noreply.github.com> Date: Thu, 18 Apr 2024 13:22:34 +0200 Subject: [PATCH] chore: replace the app-name input by a github default variable --- README.md | 1 - action.yml | 21 ++++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 27a675f..1e158ce 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ The action will consider both branches on the same repository, and pull requests Place this script in your repository in `.github/workflows/` and modify the following values: - `` for the type of app -- `` for the name of your app - `region` for where you want the app to be deployed - `` and `variable_value` for your environment variables diff --git a/action.yml b/action.yml index 12ecef0..e07e802 100644 --- a/action.yml +++ b/action.yml @@ -47,26 +47,24 @@ jobs: CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }} ORGA_ID: ${{ secrets.ORGA_ID }} # Use "clever create" to deploy your app. - # Replace , and + # Replace and run: | - clever create --type -PR-${{ github.event.number }} --alias -PR-${{ github.event.number }} --region --org "$ORGA_ID" + clever create --type ${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }} --alias ${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }} --region --org "$ORGA_ID" # Set environment variable with "clever env set". # For example: clever env set CC_WEBROOT "/public" # Inject your secrets as well, for ex: #clever env set HUGO_VERSION ${{env.HUGO_VERSION}} clever env set "" # Set review app domain with "clever domain add". - # Replace - clever domain add -PR-${{ github.event.number }}.cleverapps.io + clever domain add ${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }}.cleverapps.io clever deploy # Post your domain in PR's discussion - # Replace - name: Comment PR uses: actions/github-script@v5 with: script: | const issue_number = context.payload.pull_request.number; - const message = `Deployment has finished 👁️👄👁️ Your app is available [here](https://-PR-${{ github.event.number }}.cleverapps.io)`; + const message = `Deployment has finished 👁️👄👁️ Your app is available [here](https://${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }}.cleverapps.io)`; github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -99,17 +97,15 @@ jobs: CLEVER_SECRET: ${{ secrets.CLEVER_SECRET }} CLEVER_TOKEN: ${{ secrets.CLEVER_TOKEN }} ORGA_ID: ${{ secrets.ORGA_ID }} - # Replace run: | - clever link -o "$ORGA_ID" -PR-${{ github.event.number }} + clever link -o "$ORGA_ID" ${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }} clever deploy - name: Comment PR uses: actions/github-script@v5 with: - # Replace script: | const issue_number = context.payload.pull_request.number; - const message = `🚀 Your app has been updated and is available [here](https://-PR-${{ github.event.number }}.cleverapps.io)`; + const message = `🚀 Your app has been updated and is available [here](https://${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }}.cleverapps.io)`; github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, @@ -130,10 +126,9 @@ jobs: - name: install clever-tools run: npm install -g clever-tools - name: Delete app - # Replace run: | - clever link -o "$ORGA_ID" -PR-${{ github.event.number }} - clever delete --alias -PR-${{ github.event.number }} --yes + clever link -o "$ORGA_ID" ${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }} + clever delete --alias ${{ github.event.pull_request.base.repo.name }}-PR-${{ github.event.number }} --yes - name: Comment PR uses: actions/github-script@v5 with: