GitHub Actions - Environment URL not present on the summary screen

Recently we noticed on our workflows executions that for some unknown reason the URL from the environment deployed stopped being shown on the summary screen.

GitHub Actions - Workflow log
image


  e2e-tests-android-report:
    runs-on: [self-hosted, linux, mobile]
    needs: e2e-tests-android
    environment:
      name: allure
      url: ${{ steps.get_job_url.outputs.url_output }}
    if: always() && (needs.e2e-tests-android.result == 'success' || needs.e2e-tests-android.result == 'failure')
    steps:
      - uses: actions/download-artifact@v2
        with:
          name: e2e-android-result
          path: output/report

      - name: Get Allure History
        uses: actions/checkout@v2
        with:
          ref: e2e-report-pages
          path: e2e-report-pages

      - name: Generate Allure Report
        uses: simple-elf/allure-report-action@master
        with:
          allure_results: output/report
          allure_report: ${{ env.BRANCH_NAME }}/android
          gh_pages: e2e-report-pages
          allure_history: output/report/allure-history
          subfolder: ${{ env.BRANCH_NAME }}/android

      - name: Deploy Allure Report to Github Pages
        uses: peaceiris/actions-gh-pages@v2
        env:
          PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PUBLISH_BRANCH: e2e-report-pages
          PUBLISH_DIR: output/report/allure-history
          DESTINATION_DIR: ${{ env.BRANCH_NAME }}/android

      - name: Get Job URL
        id: get_job_url
        run: echo ::set-output name=url_output::"https://ALJAZEERAPLUS.github.io/ump/${{ env.BRANCH_NAME }}/android/${{ github.run_number }}"

All of these jobs should have the URL present.
image

Besides that, on all of our workflows, this is happening as well.

I raised a support ticket and turns out that this is actually an issue on GitHub today and they opened an internal ticket to resolve this.

I just lost some time trying to debug this too, @vhsantos26! I’ve been able to verify via the API that the environment_url property is an empty string for my environments when the url is set in jobs.environment.url.

I guess there’s a problem with the integration between GitHub Actions and Deployments, as there’s a bunch of different configurations of media type required and some of the properties may have side effects (here’s someone encountering a similar issue: target_url doesn’t make it through to deployment_status events #25).

The current workaround I’m using is to explicitly create the deployment, and set the status, e.g:

jobs:
  deploy-app:
    runs-on: ubuntu-latest
    environment:
      name: "${{ github.head_ref }}"
    steps:
      - uses: chrnorm/deployment-action@releases/v1
        name: Create GitHub deployment
        id: deployment
        with:
          token: "${{ github.token }}"
          environment: "${{ github.head_ref }}"
          target_url: "https://www.example.com"
      - name: Update deployment status (success)
        uses: chrnorm/deployment-status@releases/v1
        with:
          token: "${{ github.token }}"
          environment_url: "https://www.example.com"
          state: "success"
          deployment_id: "${{ steps.deployment.outputs.deployment_id }}"

which seems to help, I have the “View Deployment” link in my Environments now, but still not included in the Pull Request – so there might be more to do with the workaround.

2 Likes

Thanks shrink! I was wondering what was going on with this and spent a gross amount of time trying to figure it out–didn’t even occur to me it might be an issue within github, since I only recently created the repo.

Is there some way to do this upon creation? This is messing up automated testing for me, as the testing service isn’t getting a url to test against once the deploy happens.

Edit: are you sure that workaround works? I just spent a good while directly fiddling the api and it blithely ignores me anytime I try to add environment_url.

Have you heard anything about this ticket? Is it one that us mere plebs can subscribe to updates for?

2 Likes

Thanks @shrink, I will take a look on this but as we don’t have a hurry on this today, and sometimes works, I will wait the support fix it

@tquid I’ve opened this from the private org so it’s not possible but so far this was what I received so far

Hi Victor,

Thank you for writing to GitHub Enterprise Support.

I was able to reproduce this. I have opened a ticket for Engineering to investigate and clarify this. I will let you know as soon as I have an update from them.

Regards,
Paul
GitHub Support
1 Like

Apologies, I didn’t see this question. I don’t have a great deal of confidence in that workaround – i.e: it worked at the time as far as I know, but maybe I was seeing side effects of something else I tried. I did experience the API performing as expected with environment_url though, i.e:

curl --request POST \
  --url https://api.github.com/repos/{org}/{repo}/deployments/{deployment}/statuses \
  --header 'Accept: application/vnd.github.ant-man-preview+json' \
  --header 'Authorization: token ghp_...' \
  --data '{"state":"success", "environment_url": "https://www.example.com"}'
{
  // ...
  "state": "success",
  "environment_url": "https://www.example.com",
  "performed_via_github_app": null
  // ...
}