cloudnativegeo / cloud-optimized-geospatial-formats-guide

https://guide.cloudnativegeo.org
Creative Commons Attribution 4.0 International
121 stars 17 forks source link

Add restriction to only run for PRs with main as the target. #86

Closed zacharyDez closed 8 months ago

zacharyDez commented 8 months ago

What I Changed

For background information: See #74.

The preview action on external forks has failed because the pr-preview-action does not support preview on external forks. Also, it intends to refrain from supporting in the future.

The PR changes the preview action to only run on PRs to main.

How I tested it

For the changes to ci.yml:

pr-test-success.json

{
  "pull_request": {
    "head": {
      "ref": "staging"
    },
    "base": {
      "ref": "main"
    }
  }
}

pr-test-fail.json

{
  "pull_request": {
    "head": {
      "ref": "random"
    },
    "base": {
      "ref": "main"
    }
  }
}

Run the workflows of the added job with:

act pull_request -W .github/workflows/ci.yml -e p.json -j pr-test-success
act pull_request -W .github/workflows/ci.yml -e p.json -j pr-test-fail
github-actions[bot] commented 8 months ago

PR Preview Action v1.4.4 :---: :rocket: Deployed preview to https://cloudnativegeo.github.io/cloud-optimized-geospatial-formats-guide/pr-preview/pr-86/ on branch gh-pages at 2023-10-27 22:19 UTC

wildintellect commented 8 months ago

@zacharyDez can you explain the duplication of code across jobs in the workflow? also the json samples posted in the comments for success and fail appear to be identical - typo in copying?

zacharyDez commented 8 months ago

Mishaps on my side, @wildintellect . Removed the duplicates and changed the example file in the comment!