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

Surge.sh website preview workflow failing but does not raise error #259

Closed
scottyhq opened this issue May 17, 2024 · 4 comments
Closed

Surge.sh website preview workflow failing but does not raise error #259

scottyhq opened this issue May 17, 2024 · 4 comments

Comments

@scottyhq
Copy link
Contributor

https://github.com/xarray-contrib/xarray-tutorial/actions/runs/9135494118/job/25122893778

I'm guessing the TOKEN from last year just expired at some point. cc @lsetiawan

Might need some minor changes to the workflow (afc163/surge-preview#255)

@lsetiawan
Copy link
Member

I'll take a look on Monday. Thanks!

@scottyhq
Copy link
Contributor Author

I just recalled that I don't think the preview ever worked for PRs coming from forks. Because those workflows have a blank SURGE_TOKEN!

I think it's great to be able to preview content coming from forks. I don't know if there is a better state-of-the art these days, but this is the approach we take for hackweek websites to accomplish this (basically anyone with repo admin permission adds a label to grant access to the token):

https://github.com/uwhackweek/jupyterbook-template/blob/3bddb53b98f0ec234850e9529b241632d7aa6b5e/.github/workflows/netlifypreview.yaml#L4-L18

on:
  pull_request_target:
    types: [labeled, synchronize]

jobs:
  add-preview:
    runs-on: ubuntu-latest
    # This workflow accesses secrets and checks out a PR, so only run if labelled
    # https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
    if: contains(github.event.pull_request.labels.*.name, 'preview')

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
      with:
        ref: ${{ github.event.pull_request.head.sha }}

@scottyhq
Copy link
Contributor Author

scottyhq commented Jun 6, 2024

Helpful discussion here about various options:

@scottyhq
Copy link
Contributor Author

scottyhq commented Jun 25, 2024

I think closed by #260, see afc163/surge-preview#294 and related discussion.

Sometimes the workflow still fails with only a Warning rather than an error code:

Unable to get the PR number with API search: HttpError: You have exceeded a secondary rate limit. Please wait a few minutes before you try again.

Waiting a few minutes and 're-run all jobs' seems to sort things out.

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

No branches or pull requests

2 participants