githubgithub-actionsbuilding-github-actions

GitHub Actions pull request output link


I am using an S3 bucket to deploy my HTML website. Now I have created a GitHub Action that will deploy to the S3 bucket when pushed to the master branch in my repository.

Now I have created a develop branch and want to merge my changes to master using a pull request, I have written another GitHub Action to sync to the S3 bucket when a PR is created on master to view the changes before merging it.

I am able to create a PR and the GitHub Action is triggered and the S3 bucket is getting synced and website is deployed, thing is I want the link of the website to be in the PR as well.

I am unable to figure that out. Is it possible to display the link to the website when the action is completed?

PR Request

My Actions configuration:

name: Website Pull Request

on:
  pull_request:
    branches:
      - master

jobs:
  static:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: S3 Syncing
      uses: jakejarvis/s3-sync-action@master
      with:
        args: --follow-symlinks --delete --exclude '.git*/*'
      env:
        AWS_S3_BUCKET: ${{ secrets.AWS_TEST_S3_BUCKET }}
        AWS_ACCESS_KEY_ID: ${{ secrets.AWS_TEST_ACCESS_KEY }}
        AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_TEST_ACCESS_SECRET }}
        AWS_REGION: 'ap-south-1'

Solution

  • If you know the website link upfront (or you are able to retrieve it in some automated way) then you can add it as a PR comment after deploying the website to S3. You can use a dedicated GitHub Action to add a customized PR comment with a link to the deployed website. There are plenty of them on GitHub Marketplace.