Skip to content
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

Issue while cleaning up the new instance #5

Open
subhojit-axl opened this issue Mar 16, 2022 · 4 comments
Open

Issue while cleaning up the new instance #5

subhojit-axl opened this issue Mar 16, 2022 · 4 comments

Comments

@subhojit-axl
Copy link

We are using this action to setup feature instances when a developer creates pull request. We have another GitHub action that is supposed to delete the feature instance when the pull request is merged.

name: Do cleanup

on:
  pull_request:
    types: [ closed ]

jobs:
  merge_job:
    # this job will only run if the PR has been merged
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    container: axelerant/platformsh-cli:latest
    env:
      ENV_NAME: platform
    steps:
      - name: Check out repository code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0

      - name: Terminate instance
        run: |
          platform project:set-remote ${PLATFORM_PROJECT_ID}
          platform environment:deactivate ${GITHUB_REF_NAME} --delete-branch
        env:
          PLATFORMSH_CLI_TOKEN: ${{ secrets.PLATFORMSH_CLI_TOKEN }}

GITHUB_REF_NAME is the branch name to which the pull request is merged, not the pull request's branch name. Due to this it fails to delete the feature instance.

@hussainweb
Copy link
Member

The snippet you showed does not use the action at all. What should we change in the action for this?

@subhojit-axl
Copy link
Author

We are using this action while creating the instance. This action uses the GITHUB_REF_NAME. Since, the value of the variable is different when a pull request is merged compared to when it is created, we are facing issues in terminating the instance.

@hussainweb
Copy link
Member

Do you think we should add support in the action to even terminate instances?

@subhojit-axl
Copy link
Author

I don't think so. Although, this can be achieved with the help of a flag, but it would be better if this feature is implemented as a separate action altogether.

@skippednote skippednote pinned this issue Mar 28, 2022
@skippednote skippednote unpinned this issue Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants