Closed christopher-aldred closed 11 months ago
We use "on": pull_request
- try that?
Pull_request and pull_request_target are essentially the same but the latter has access to github tokens.
I fixed it with the following:
name: Deploy to PREVIEW
"on": pull_request_target
jobs:
build_and_preview:
permissions: write-all
if: "${{ github.event.pull_request.head.repo.full_name == github.repository }}"
runs-on: ubuntu-latest
steps:
- name: Checking out PR code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{github.event.pull_request.head.repo.full_name}}
Action config
Expected behavior
When creating a PR the preview channel should contain the application built using the code in the PR.
Actual behavior
The preview channel appears identical to the PROD/live channel. I think it maybe be using the main branch rather than the PR. So merging from develop to main it should be building and deploying the develop branch not the main.