Repository navigation
64 lines (55 loc) · 1.86 KB
/
Copy pathtrigger-codemagic.yml
File metadata and controls
64 lines (55 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Trigger Codemagic build
run-name: Codemagic build requested by @${{ github.actor }}
on:
workflow_dispatch:
permissions: {}
concurrency:
group: codemagic-owner-trigger
cancel-in-progress: false
jobs:
reject-unauthorized-request:
name: Reject unauthorized request
if: >-
github.actor != github.repository_owner ||
github.triggering_actor != github.repository_owner ||
github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 1
steps:
- name: Explain restriction
run: |
echo "::error::Only the repository owner can trigger the Codemagic build from main."
exit 1
trigger-codemagic:
name: Queue owner build
if: >-
github.actor == github.repository_owner &&
github.triggering_actor == github.repository_owner &&
github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
contents: write
steps:
- name: Check out main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Create the Codemagic trigger tag
run: |
set -euo pipefail
# Recreate one fixed tag at the current main commit. Recreating the tag
# emits a tag-created webhook without adding commits or branches.
git push origin --delete refs/tags/codemagic-build 2>/dev/null || true
git tag --force codemagic-build main
git push origin refs/tags/codemagic-build
trigger_commit="$(git rev-parse main)"
{
echo "### Codemagic webhook triggered"
echo
echo "- Workflow: \`waypoint-unsigned\`"
echo "- Source: current \`main\`"
echo "- Trigger tag: \`codemagic-build\`"
echo "- Trigger commit: \`$trigger_commit\`"
} >> "$GITHUB_STEP_SUMMARY"