Skip to content

Commit 357f53e

Browse files
committed
update main
1 parent e92f345 commit 357f53e

File tree

2 files changed

+29
-38
lines changed

2 files changed

+29
-38
lines changed

.drone.yml

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,37 @@
11
---
2-
name: sleep-for-10s
3-
kind: pipeline
4-
type: docker
5-
clone:
6-
disable: true
7-
steps:
8-
- name: sleep
9-
image: alpine
10-
commands:
11-
- sleep 10
12-
trigger:
13-
branch:
14-
exclude:
15-
- "production"
16-
- "test"
17-
- "levelbuilder"
18-
event:
19-
- pull_request
202

21-
---
223
kind: pipeline
234
type: docker
24-
name: trigger-github-workflow-on-droneci-success
5+
name: on-droneci-complete
256
clone:
267
disable: true
278
steps:
28-
- name: trigger-gh
9+
- name: trigger-github-actions
2910
image: plugins/webhook
3011
settings:
3112
urls:
32-
- https://api.github.com/repos/code-dot-org/code-dot-org/actions/workflows/on-droneci-success.yml/dispatches
13+
- https://api.github.com/repos/code-dot-org/test-workflow-dispatch/actions/workflows/on-droneci-complete.yml/dispatches
3314
username: x-access-token
3415
secrets:
35-
- source: github_token_on_droneci_success
16+
- source: on-droneci-complete-github-token
3617
target: webhook_password
3718
template: |
3819
{
3920
"ref": "{{ build.branch }}",
4021
"inputs": {
41-
"commit": "{{ build.commit }}"
22+
"github_sha": "{{ build.commit }}",
23+
"drone_succeeded": {{ eq build.status 'success' }}
4224
}
4325
}
4426
debug: true
45-
depends_on:
46-
- sleep-for-10s
47-
# - unit
48-
# - ui
27+
# depends_on:
28+
# - unit
29+
# - ui
4930
trigger:
5031
event:
5132
- pull_request
52-
status:
53-
- success
5433
---
5534
kind: signature
56-
hmac: 41d486edcab857043b4bb1f9f5c24dd1bdb560a24f5e5ecb25ca196edf6013db
35+
hmac: 64f80f45bacfea906a0a36dedfb08b3f5c8394d2aacfb182e6104300965e2bb5
5736

5837
...

.github/workflows/on-droneci-complete.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,64 @@ on:
66
github_sha:
77
description: "equivalent to github.sha in an ordinary workflow"
88
required: true
9-
success:
9+
drone_succeeded:
1010
description: "did drone tests pass or fail?"
1111
required: true
1212
type: boolean
1313

14+
permissions:
15+
statuses: write
16+
1417
jobs:
1518
# This one should pass
1619
cms-followup:
1720
runs-on: ubuntu-24.04
21+
if: ${{ inputs.drone_succeeded }}
1822
# uses: ./.github/workflows/cms-followup.yml
1923
steps:
2024
- run: |
21-
echo "Triggered by Drone commit: ${{ inputs.github_sha }} on branch ${{ github.ref }}"
22-
echo "This step should succeed"
25+
echo "Triggered by Drone, on commit: ${{ inputs.github_sha }} on branch ${{ github.ref }}"
26+
echo "This job should succeed"
2327
true
2428
2529
# Need to update commit status manually, or the result won't be visible within the PR:
2630
- uses: actions/github-script@v7
31+
if: always()
2732
with:
2833
script: |
2934
await github.rest.repos.createCommitStatus({
3035
context: 'CMS Followup',
36+
description: 'blah blah blah',
3137
owner: context.repo.owner,
3238
repo: context.repo.repo,
3339
sha: '${{ inputs.github_sha }}',
34-
state: ${{ job.status == 'success' && 'success' || 'failure' }}
40+
state: '${{ job.status == 'success' && 'success' || 'failure' }}'
3541
})
3642
3743
# This one should fail
3844
k8s-followup:
3945
runs-on: ubuntu-24.04
46+
if: ${{ inputs.drone_succeeded }}
4047
# uses: ./.github/workflows/k8s-followup.yml
4148
steps:
4249
- run: |
43-
echo "Triggered by Drone commit: ${{ inputs.github_sha }} on branch ${{ github.ref }}"
44-
echo "This step should fail"
50+
echo "Triggered by Drone, on commit: ${{ inputs.github_sha }} on branch ${{ github.ref }}"
51+
echo "This job should fail"
4552
false
4653
54+
- if: always()
55+
run: echo "k"
56+
4757
# Need to update commit status manually, or the result won't be visible within the PR:
4858
- uses: actions/github-script@v7
59+
if: always()
4960
with:
5061
script: |
5162
await github.rest.repos.createCommitStatus({
5263
context: 'K8S Followup',
64+
description: 'blah blah blah',
5365
owner: context.repo.owner,
5466
repo: context.repo.repo,
5567
sha: '${{ inputs.github_sha }}',
56-
state: ${{ job.status == 'success' && 'success' || 'failure' }}
68+
state: '${{ job.status == 'success' && 'success' || 'failure' }}'
5769
})

0 commit comments

Comments
 (0)