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

Add dev deploy workflow #17

Merged
merged 1 commit into from
May 5, 2021
Merged

Add dev deploy workflow #17

merged 1 commit into from
May 5, 2021

Conversation

parth-07
Copy link
Member

@parth-07 parth-07 commented May 3, 2021

This PR adds github workflow for automatic deployment to development server on encountering trigger command in the PR comments.

Trigger command: @github deploy

Github action bot will give rocket reaction to the comment on encountering trigger command, and then if the command is given by a valid user, initiates deployment

Closes #12

@parth-07
Copy link
Member Author

parth-07 commented May 3, 2021

@manorit2001 Can you please check why deploy isn't triggering deployment event.

@manorit2001
Copy link
Member

manorit2001 commented May 3, 2021

@manorit2001 Can you please check why deploy isn't triggering deployment event.

Ah, I just checked. It seems that the project is not that maintained anymore
https://github.com/helaili/deploy

image

Test and staging environment are abandoned as per this which is causing the issues ig. Let's try to find some other similar project then

@manorit2001
Copy link
Member

and if not found, we can resort to this ig

@parth-07
Copy link
Member Author

parth-07 commented May 3, 2021

This also seems promising, https://github.com/marketplace/actions/pull-request-comment-trigger, we can perhaps trigger deployment using comment triggers with this.

@manorit2001
Copy link
Member

This also seems promising, https://github.com/marketplace/actions/pull-request-comment-trigger, we can perhaps trigger deployment using comment triggers with this.

If we can change settings so that only collaborators can trigger it, then it seems good

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

deploy

1 similar comment
@manorit2001
Copy link
Member

deploy

@github-actions github-actions bot temporarily deployed to dev May 4, 2021 16:42 Inactive
@manorit2001
Copy link
Member

@parth-07 it works!

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

@manorit2001 yayy :)

@manorit2001
Copy link
Member

things are being deployed even if we comment in issue, prevent that

@github-actions github-actions bot temporarily deployed to dev May 4, 2021 16:53 Inactive
@manorit2001
Copy link
Member

it seems like i can't write the work dep-loyed anymore 😂

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

@github deploy

@github-actions github-actions bot temporarily deployed to dev May 4, 2021 17:10 Inactive
@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

@manorit2001 Yes, @github deploy works, so I guess we will be tagging github everytime while deploying xD

@github-actions github-actions bot temporarily deployed to dev May 4, 2021 17:11 Inactive
@manorit2001
Copy link
Member

deployed again 😂

@manorit2001
Copy link
Member

and try to prevent running of workflow from issues altogether if possible

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

@manorit2001 Ideally, it should just match if command is present at start of the comment. But alas, it checks the entire comment body.

@manorit2001
Copy link
Member

manorit2001 commented May 4, 2021

@manorit2001 Ideally, it should just match if command is present at start of the comment. But alas, it checks the entire comment body.

@github don't deploy

just a check xD

EDIT: ah, atleast it doesn't match things like a subsequence, that's a plus

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

and try to prevent running of workflow from issues altogether if possible

This seems more difficult, issues_comment works for both issues and pull requests, it seems internally github treats pull requests as issues only.

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

EDIT: ah, atleast it doesn't match things like a subsequence, that's a plus

Yeah seriously, that would be a nighmare xD

@manorit2001
Copy link
Member

This seems more difficult, issues_comment works for both issues and pull requests, it seems internally github treats pull requests as issues only.

src: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#issue_comment
we can add this if condition ig

on: issue_comment

jobs:
  pr_commented:
    # This job only runs for pull request comments
    name: PR comment
    if: ${{ github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Comment on PR #${{ github.event.issue.number }}"

  issue_commented:
    # This job only runs for issue comments
    name: Issue comment
    if: ${{ !github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Comment on issue #${{ github.event.issue.number }}"

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

This seems more difficult, issues_comment works for both issues and pull requests, it seems internally github treats pull requests as issues only.

src: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#issue_comment
we can add this if condition ig

on: issue_comment

jobs:
  pr_commented:
    # This job only runs for pull request comments
    name: PR comment
    if: ${{ github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Comment on PR #${{ github.event.issue.number }}"

  issue_commented:
    # This job only runs for issue comments
    name: Issue comment
    if: ${{ !github.event.issue.pull_request }}
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Comment on issue #${{ github.event.issue.number }}"

Workflow will still be triggered in these cases, right ? Job will be skipped though.

@manorit2001
Copy link
Member

manorit2001 commented May 4, 2021

Workflow will still be triggered in these cases, right ? Job will be skipped though.

Ah, makes sense, but the authentication job is still being run, we can skip that also when running things on issue

@manorit2001 manorit2001 linked an issue May 4, 2021 that may be closed by this pull request
@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

Workflow will still be triggered in these cases, right ? Job will be skipped though.

Ah, makes sense, but the authentication job is still being run, we can skip that also when running things on issue

Yes agreed, that step should be skipped.

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

@github deploy

@parth-07
Copy link
Member Author

parth-07 commented May 4, 2021

@github deploy

@github-actions github-actions bot temporarily deployed to dev May 4, 2021 17:39 Inactive
@parth-07 parth-07 closed this May 5, 2021
@parth-07 parth-07 force-pushed the add-deploy-workflow branch from eca5c9f to bb8bdd3 Compare May 5, 2021 03:54
@parth-07 parth-07 reopened this May 5, 2021
@parth-07 parth-07 requested a review from manorit2001 May 5, 2021 04:14
Copy link
Member

@manorit2001 manorit2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, The deployment works fine but I can see some warnings in Github Actions. I know they won't matter much as deployment works fine but I would at least like you to look into it once if you can fix them

@parth-07
Copy link
Member Author

parth-07 commented May 5, 2021

Hi, The deployment works fine but I can see some warnings in Github Actions. I know they won't matter much as deployment works fine but I would at least like you to look into it once if you can fix them

Those warnings cannot be removed, they are due to using octokit for making API requests, they are mentioned in the documentation page too https://github.com/octokit/request-action#warnings

@manorit2001
Copy link
Member

Those warnings cannot be removed, they are due to using octokit for making API requests, they are mentioned in the documentation page too https://github.com/octokit/request-action#warnings

Ah, seems right, cool

Copy link
Member

@manorit2001 manorit2001 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@manorit2001 manorit2001 merged commit bca7c5f into master May 5, 2021
@parth-07 parth-07 deleted the add-deploy-workflow branch May 5, 2021 09:32
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 this pull request may close these issues.

CI setup
2 participants