|
6 | 6 | github_sha:
|
7 | 7 | description: "equivalent to github.sha in an ordinary workflow"
|
8 | 8 | required: true
|
9 |
| - success: |
| 9 | + drone_succeeded: |
10 | 10 | description: "did drone tests pass or fail?"
|
11 | 11 | required: true
|
12 | 12 | type: boolean
|
13 | 13 |
|
| 14 | +permissions: |
| 15 | + statuses: write |
| 16 | + |
14 | 17 | jobs:
|
15 | 18 | # This one should pass
|
16 | 19 | cms-followup:
|
17 | 20 | runs-on: ubuntu-24.04
|
| 21 | + if: ${{ inputs.drone_succeeded }} |
18 | 22 | # uses: ./.github/workflows/cms-followup.yml
|
19 | 23 | steps:
|
20 | 24 | - 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" |
23 | 27 | true
|
24 | 28 |
|
25 | 29 | # Need to update commit status manually, or the result won't be visible within the PR:
|
26 | 30 | - uses: actions/github-script@v7
|
| 31 | + if: always() |
27 | 32 | with:
|
28 | 33 | script: |
|
29 | 34 | await github.rest.repos.createCommitStatus({
|
30 | 35 | context: 'CMS Followup',
|
| 36 | + description: 'blah blah blah', |
31 | 37 | owner: context.repo.owner,
|
32 | 38 | repo: context.repo.repo,
|
33 | 39 | sha: '${{ inputs.github_sha }}',
|
34 |
| - state: ${{ job.status == 'success' && 'success' || 'failure' }} |
| 40 | + state: '${{ job.status == 'success' && 'success' || 'failure' }}' |
35 | 41 | })
|
36 | 42 |
|
37 | 43 | # This one should fail
|
38 | 44 | k8s-followup:
|
39 | 45 | runs-on: ubuntu-24.04
|
| 46 | + if: ${{ inputs.drone_succeeded }} |
40 | 47 | # uses: ./.github/workflows/k8s-followup.yml
|
41 | 48 | steps:
|
42 | 49 | - 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" |
45 | 52 | false
|
46 | 53 |
|
| 54 | + - if: always() |
| 55 | + run: echo "k" |
| 56 | + |
47 | 57 | # Need to update commit status manually, or the result won't be visible within the PR:
|
48 | 58 | - uses: actions/github-script@v7
|
| 59 | + if: always() |
49 | 60 | with:
|
50 | 61 | script: |
|
51 | 62 | await github.rest.repos.createCommitStatus({
|
52 | 63 | context: 'K8S Followup',
|
| 64 | + description: 'blah blah blah', |
53 | 65 | owner: context.repo.owner,
|
54 | 66 | repo: context.repo.repo,
|
55 | 67 | sha: '${{ inputs.github_sha }}',
|
56 |
| - state: ${{ job.status == 'success' && 'success' || 'failure' }} |
| 68 | + state: '${{ job.status == 'success' && 'success' || 'failure' }}' |
57 | 69 | })
|
0 commit comments