Skip to content

Commit 73032be

Browse files
committed
Run validation mode via docker run so the event name actually applies
1 parent 176409d commit 73032be

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151
cp .e2e-action/dockerfile .e2e-action/Dockerfile
5252
fi
5353
54+
- name: Build the action image
55+
run: docker build -t codejson-action .e2e-action
56+
5457
- name: Link back to the pull request
5558
run: |
5659
echo "Testing [PR #${{ inputs.pr_number }}](https://github.com/DSACMS/automated-codejson-generator/pull/${{ inputs.pr_number }}) at \`${{ inputs.action_sha }}\`" >> "$GITHUB_STEP_SUMMARY"
@@ -59,27 +62,29 @@ jobs:
5962
run: cp e2e/fixtures/code.json.good code.json
6063

6164
- name: Validate the good code.json
62-
uses: ./.e2e-action
63-
env:
64-
# The action validates instead of generating when it sees a pull_request
65-
# event. That is the only switch for this mode, so we set it directly.
66-
GITHUB_EVENT_NAME: pull_request
67-
with:
68-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
BRANCH: main
65+
run: |
66+
# GITHUB_EVENT_NAME can't be set through uses:, so run the image ourselves
67+
# to put the action in validation mode.
68+
docker run --rm \
69+
-e GITHUB_EVENT_NAME=pull_request \
70+
-e GITHUB_ACTION=e2e \
71+
-e INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
72+
-v "${{ github.workspace }}:/github/workspace" \
73+
codejson-action
7074
7175
- name: Stage a broken code.json
7276
run: cp e2e/fixtures/code.json.broken code.json
7377

7478
- name: Validate the broken code.json
7579
id: validate_broken
7680
continue-on-error: true
77-
uses: ./.e2e-action
78-
env:
79-
GITHUB_EVENT_NAME: pull_request
80-
with:
81-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82-
BRANCH: main
81+
run: |
82+
docker run --rm \
83+
-e GITHUB_EVENT_NAME=pull_request \
84+
-e GITHUB_ACTION=e2e \
85+
-e INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
86+
-v "${{ github.workspace }}:/github/workspace" \
87+
codejson-action
8388
8489
- name: Assert the broken code.json was rejected
8590
run: |

0 commit comments

Comments
 (0)