From f5575487e721cbb5a609354b55fb1dd914b7a23b Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Mon, 28 Oct 2024 09:55:31 +0800 Subject: [PATCH] ci: fix tests on forks (#260) * [ci: debug github env again to get it working on forks](https://github.com/bevry/dorothy/pull/260/commits/29dbacb75074735c654ca3fa17ae8da96af90f91) * [ci: read PR head repo full_name](https://github.com/bevry/dorothy/pull/260/commits/d81681b67b0d3fa2472508bd02c532a6da7e00c0) * [ci: use the PR slug if available](https://github.com/bevry/dorothy/pull/260/commits/93d255b1265a1f504d88652699455e12e9e327f0) --- .github/workflows/dorothy-workflow.yml | 34 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dorothy-workflow.yml b/.github/workflows/dorothy-workflow.yml index d3f04d5c6..f498cc016 100644 --- a/.github/workflows/dorothy-workflow.yml +++ b/.github/workflows/dorothy-workflow.yml @@ -30,6 +30,30 @@ jobs: github.event.pull_request.assignees: ${{ github.event_name == 'pull_request' && toJson( toJson(github.event.pull_request.assignees) != '[]' ) }} + + github.repository: + ${{ toJson(github.repository) }} + + github.event.pull_request.head.repo.full_name: + ${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.head.repo.full_name) }} + + github.event.pull_request.head.sha: + ${{ github.event_name == 'pull_request' && toJson(github.event.pull_request.head.sha) }} + + github.sha: + ${{ toJson(github.sha) }} + + github.ref + ${{ toJson(github.ref) }} + + resolved slug: + ${{ toJson(github.event.pull_request.head.repo.full_name || github.repository) }} + + resolved sha: + ${{ toJson(github.event.pull_request.head.sha || github.sha) }} + + github: + ${{ false && toJson(github) }} EGITHUB login-shells-and-linting: if: github.event_name == 'push' || ( github.event_name == 'pull_request' && toJson(github.event.pull_request.draft) == 'false' && toJson(github.event.pull_request.state) == '"open"' && toJson(github.event.pull_request.assignees) != '[]' ) @@ -40,7 +64,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/install?slug=${{ github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/install?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" - name: 'Dorothy Configure' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting @@ -58,7 +82,7 @@ jobs: setup-util-dash setup-util-ksh setup-util-carapace - dorothy --slug=${{ github.repository }} install + dorothy --slug=${{ github.event.pull_request.head.repo.full_name || github.repository }} install # nu -c 'echo $nu.loginshell-path' - name: 'Dorothy Login Shell: bash' shell: bash -leo pipefail {0} @@ -148,7 +172,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test fresh-macos-test: if: github.event_name == 'push' || ( github.event_name == 'pull_request' && toJson(github.event.pull_request.draft) == 'false' && toJson(github.event.pull_request.state) == '"open"' && toJson(github.event.pull_request.assignees) != '[]' ) strategy: @@ -166,7 +190,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test container-test: if: github.event_name == 'push' || ( github.event_name == 'pull_request' && toJson(github.event.pull_request.draft) == 'false' && toJson(github.event.pull_request.state) == '"open"' && toJson(github.event.pull_request.assignees) != '[]' ) runs-on: ubuntu-latest @@ -238,4 +262,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # prevent rate limiting run: | # ensure dorothy is cloned, and run command - bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test + bash -c "$(curl -fsSL 'https://dorothy.bevry.me/run?slug=${{ github.event.pull_request.head.repo.full_name || github.repository }}&commit=${{ github.event.pull_request.head.sha || github.sha }}')" -- dorothy test