Skip to content

Commit fc73325

Browse files
authored
Fix execution in windows runner (#9413)
Currently, when `/windows-test` command is added the workflow run tests with `main` branch and status is not updated, always listed as skipped.
1 parent e35705b commit fc73325

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

.github/workflows/ci-windows.yml

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ permissions:
4343
contents: read
4444

4545
jobs:
46-
core:
47-
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event.client_payload.slash_command.command == 'windows-test' }}
46+
main:
47+
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
4848
runs-on: self-hosted
4949
permissions:
5050
checks: write
@@ -53,3 +53,61 @@ jobs:
5353
- name: Build with Gradle
5454
run: ./gradlew.bat cleanTest testcontainers:test --no-daemon --continue --scan --no-build-cache
5555
- uses: ./.github/actions/setup-junit-report
56+
57+
pr:
58+
if: ${{ github.event.client_payload.slash_command.command == 'windows-test' }}
59+
runs-on: self-hosted
60+
permissions:
61+
checks: write
62+
steps:
63+
- name: Create pending status
64+
uses: actions/github-script@v7
65+
with:
66+
github-token: ${{ secrets.GITHUB_TOKEN }}
67+
script: |
68+
github.repos.createStatus({
69+
owner: context.repo.owner,
70+
repo: context.repo.repo,
71+
sha: context.payload.client_payload.pull_request.head.sha,
72+
state: 'pending',
73+
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
74+
context: 'CI - Windows',
75+
})
76+
- uses: actions/checkout@v4
77+
with:
78+
token: ${{ secrets.GITHUB_TOKEN }}
79+
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
80+
ref: ${{ github.event.client_payload.pull_request.head.ref }}
81+
- name: Build with Gradle
82+
run: ./gradlew.bat cleanTest testcontainers:test --no-daemon --continue --scan --no-build-cache
83+
- uses: ./.github/actions/setup-junit-report
84+
85+
- name: Create success status
86+
uses: actions/github-script@v7
87+
if: success()
88+
with:
89+
github-token: ${{ secrets.GITHUB_TOKEN }}
90+
script: |
91+
github.repos.createStatus({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
sha: context.payload.client_payload.pull_request.head.sha,
95+
state: 'success',
96+
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
97+
context: 'CI - Windows',
98+
})
99+
100+
- name: Create failure status
101+
uses: actions/github-script@v7
102+
if: failure()
103+
with:
104+
github-token: ${{ secrets.GITHUB_TOKEN }}
105+
script: |
106+
github.repos.createStatus({
107+
owner: context.repo.owner,
108+
repo: context.repo.repo,
109+
sha: context.payload.client_payload.pull_request.head.sha,
110+
state: 'failure',
111+
target_url: `https://github.com/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,
112+
context: 'CI - Windows',
113+
})

0 commit comments

Comments
 (0)