This repository was archived by the owner on Oct 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
120 lines (99 loc) · 4.03 KB
/
integrate_llvm.yml
File metadata and controls
120 lines (99 loc) · 4.03 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Copyright (c) 2024.
name: Auto Integrate LLVM
on:
workflow_dispatch:
schedule:
# At minute 0 past hour 1. (see https://crontab.guru)
- cron: '00 01 * * *'
concurrency:
# A PR number if a pull request and otherwise the commit hash. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit). The workflow name is prepended to avoid conflicts between
# different workflows.
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
update-dep:
name: "Integrate LLVM and send PR"
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: "Check out repository"
uses: actions/checkout@v4.2.2
with:
fetch-depth: 2
- name: Restore LLVM project cache
id: llvm-project-restore
uses: actions/cache/restore@v4
with:
path: /tmp/llvm-project
key: cache-llvm-project
- name: "Get llvm-project"
shell: bash
id: get-llvm-project
run: |
# https://github.com/actions/cache/issues/1566
if [ "${{ steps.llvm-project-restore.outputs.cache-hit }}" == "" ]; then
git clone https://github.com/llvm/llvm-project.git /tmp/llvm-project
fi
pushd /tmp/llvm-project
git pull origin main
echo "LLVM_SHA_SHORT=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
popd
- name: Save LLVM project cache
id: llvm-project-save
uses: actions/cache/save@v4
with:
path: /tmp/llvm-project
key: "cache-llvm-project-${{ format('{0}-{1}', github.ref_name, github.run_number) }}"
- name: "Make filtered llvm-project"
id: make-filtered-llvm-project
shell: bash
run: |
DEBIAN_FRONTEND=noninteractive sudo apt install -y git-filter-repo
HERE=$(pwd)
pushd /tmp/llvm-project
bash $HERE/filter-llvm.sh
popd
- name: "Rebase on top of llvm-project"
shell: bash
id: rebase-llvm-project
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git pull /tmp/llvm-project main --no-rebase --ff
- name: Generate token
uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.BUMP_LLVM_CREATE_PR_APP_ID }}
private-key: ${{ secrets.BUMP_LLVM_CREATE_PR_APP_PRIVATE_KEY }}
- name: "Create Pull Request"
id: cpr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: "[LLVM] Integrate to ${{ steps.get-llvm-project.outputs.LLVM_SHA_SHORT }}"
title: "[LLVM] Integrate to ${{ steps.get-llvm-project.outputs.LLVM_SHA_SHORT }}"
body: "Integrate LLVM to https://github.com/llvm/llvm-project/commit/${{ steps.get-llvm-project.outputs.LLVM_SHA_SHORT }}"
author: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
base: main
branch: update-llvm
delete-branch: true
- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ steps.generate-token.outputs.token }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: rebase
- name: Auto approve
if: steps.cpr.outputs.pull-request-operation == 'created'
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}