1# //.github/workflows:trunk.yml
2#
3# This file exists to define the steps executed for a push to the default tree.
4# For configuring the steps that occur after a push to all other branches under
5# the refs/heads namespace, see `//.github/workflows:presubmit.yml`.
6---
7name: trunk
8
9on:
10 push:
11 branches:
12 - trunk
13
14concurrency:
15 group: ${{ github.ref }}
16 cancel-in-progress: true
17
18permissions:
19 contents: read
20
21jobs:
22 build-and-test:
23 uses: ./.github/workflows/build-and-test.yml
24 secrets: inherit
25
26 benchmark:
27 runs-on: ubuntu-latest
28 permissions:
29 contents: write
30 deployments: write
31 steps:
32 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33
34 - uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
35 with:
36 go-version: 1.24.2
37
38 - name: Run benchmark
39 run: go test -v ./... -bench=. -run=xxx -benchmem | tee output.txt
40
41 - name: Store benchmark result
42 uses: benchmark-action/github-action-benchmark@d48d326b4ca9ba73ca0cd0d59f108f9e02a381c7 # v1.20.4
43 with:
44 tool: 'go'
45 output-file-path: output.txt
46 github-token: ${{ secrets.GITHUB_TOKEN }}
47 comment-on-alert: true
48 auto-push: true
49
50 mirror:
51 if: github.repository == 'git-bug/git-bug' && github.run_attempt == '1'
52 permissions:
53 contents: write
54 runs-on: ubuntu-latest
55 steps:
56 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57 with:
58 fetch-depth: 0
59
60 # we use a custom deploy key in order to allow the workflow to bypass
61 # branch protection rules. without this, pushing will be rejected
62 - name: setup authentication
63 env:
64 SSH_AUTH_SOCK: /tmp/ssh-agent.sock
65 run: |
66 mkdir -p ~/.ssh
67 echo "${{ secrets.TRUNK_MIRROR_KEY }}" > ~/.ssh/id_rsa
68 chmod 0600 ~/.ssh/id_rsa
69 ssh-agent -a $SSH_AUTH_SOCK > /dev/null
70 ssh-add ~/.ssh/id_rsa
71
72 - name: push to refs/heads/master
73 env:
74 SSH_AUTH_SOCK: /tmp/ssh-agent.sock
75 run: |-
76 git config user.name git-bug-bot
77 git config user.email no-reply@git-bug.org
78 git remote set-url origin git@github.com:git-bug/git-bug.git
79 git push --atomic origin HEAD:refs/heads/master