Test PR trigger for GH Actions runner #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test PR and Step State | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| state-test: | |
| runs-on: [self-hosted, stacktape] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set outputs and env vars | |
| id: setup | |
| run: | | |
| echo "my_output=hello-from-step-1" >> $GITHUB_OUTPUT | |
| echo "DYNAMIC_VAR=set-in-step-1" >> $GITHUB_ENV | |
| echo "Step 1 done" | |
| - name: Verify GITHUB_OUTPUT from previous step | |
| run: | | |
| VALUE="${{ steps.setup.outputs.my_output }}" | |
| echo "Output from step 1: $VALUE" | |
| if [ "$VALUE" = "hello-from-step-1" ]; then | |
| echo "PASS: GITHUB_OUTPUT works" | |
| else | |
| echo "FAIL: GITHUB_OUTPUT not propagated (got: $VALUE)" | |
| exit 1 | |
| fi | |
| - name: Verify GITHUB_ENV from previous step | |
| run: | | |
| echo "DYNAMIC_VAR=$DYNAMIC_VAR" | |
| if [ "$DYNAMIC_VAR" = "set-in-step-1" ]; then | |
| echo "PASS: GITHUB_ENV works" | |
| else | |
| echo "FAIL: GITHUB_ENV not propagated" | |
| exit 1 | |
| fi | |
| - name: Verify PR context (if triggered by PR) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| echo "PR number: ${{ github.event.pull_request.number }}" | |
| echo "PR head: ${{ github.event.pull_request.head.sha }}" | |
| echo "Merge commit: ${{ github.sha }}" | |
| echo "PASS: PR context available" | |
| - name: Verify checkout contents | |
| run: | | |
| echo "HEAD commit: $(git rev-parse HEAD)" | |
| echo "Branch: $(git branch --show-current || echo detached)" | |
| ls -la | |
| echo "PASS: Checkout valid" |