@rizom/ops 0.2.0-alpha.31 → 0.2.0-alpha.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "0.2.0-alpha.31",
7
+ "version": "0.2.0-alpha.32",
8
8
  "type": "module",
9
9
  "exports": {
10
10
  ".": {
@@ -16,6 +16,10 @@ on:
16
16
  - users/*.secrets.yaml.age
17
17
  - deploy/**
18
18
  - .github/workflows/deploy.yml
19
+ workflow_run:
20
+ workflows: [Reconcile]
21
+ types: [completed]
22
+ branches: [main]
19
23
 
20
24
  permissions:
21
25
  contents: write
@@ -23,13 +27,16 @@ permissions:
23
27
 
24
28
  jobs:
25
29
  resolve_handles:
30
+ if: >
31
+ github.event_name != 'workflow_run' ||
32
+ github.event.workflow_run.conclusion == 'success'
26
33
  runs-on: ubuntu-latest
27
34
  outputs:
28
35
  handles_json: ${{ steps.resolve.outputs.handles_json }}
29
36
  steps:
30
37
  - uses: actions/checkout@v5
31
38
  with:
32
- ref: ${{ github.sha }}
39
+ ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.sha }}
33
40
  fetch-depth: 0
34
41
 
35
42
  - uses: oven-sh/setup-bun@v2
@@ -41,7 +48,7 @@ jobs:
41
48
  id: resolve
42
49
  env:
43
50
  HANDLE_INPUT: ${{ inputs.handle || '' }}
44
- BEFORE_SHA: ${{ github.event.before || '' }}
51
+ BEFORE_SHA: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.event.before || '' }}
45
52
  run: bun deploy/scripts/resolve-deploy-handles.ts
46
53
 
47
54
  no_changes:
@@ -68,7 +75,7 @@ jobs:
68
75
  steps:
69
76
  - uses: actions/checkout@v5
70
77
  with:
71
- ref: ${{ github.sha }}
78
+ ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.sha }}
72
79
 
73
80
  - uses: oven-sh/setup-bun@v2
74
81
 
@@ -271,7 +278,7 @@ jobs:
271
278
  steps:
272
279
  - uses: actions/checkout@v5
273
280
  with:
274
- ref: ${{ github.sha }}
281
+ ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_branch || github.sha }}
275
282
 
276
283
  - uses: oven-sh/setup-bun@v2
277
284
 
@@ -9,14 +9,23 @@ if (eventName === "workflow_dispatch") {
9
9
  process.exit(0);
10
10
  }
11
11
 
12
- if (eventName !== "push") {
12
+ if (eventName !== "push" && eventName !== "workflow_run") {
13
13
  throw new Error(`Unsupported GITHUB_EVENT_NAME: ${eventName}`);
14
14
  }
15
15
 
16
16
  const beforeSha = requireEnv("BEFORE_SHA");
17
- const currentSha = requireEnv("GITHUB_SHA");
17
+ const currentSha =
18
+ eventName === "workflow_run"
19
+ ? execFileSync("git", ["rev-parse", "HEAD"], {
20
+ encoding: "utf8",
21
+ }).trim()
22
+ : requireEnv("GITHUB_SHA");
18
23
 
19
- if (!isUsableGitRevision(beforeSha) || !isUsableGitRevision(currentSha)) {
24
+ if (
25
+ !isUsableGitRevision(beforeSha) ||
26
+ !isUsableGitRevision(currentSha) ||
27
+ beforeSha === currentSha
28
+ ) {
20
29
  writeGitHubOutput("handles_json", JSON.stringify([]));
21
30
  process.exit(0);
22
31
  }