-
Notifications
You must be signed in to change notification settings - Fork 14
67 lines (62 loc) · 2.48 KB
/
pin-hyprland.yml
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
name: "Pin hyprland version to hyprgrass-main (or specific rev)"
on:
workflow_dispatch:
inputs:
hyprland_rev:
description: 'Hyprland revision'
required: true
type: string
hyprgrass_rev:
description: 'Hyprgrass revision'
required: false
type: string
default: 'main'
jobs:
add-hyprpm-pin:
runs-on: ubuntu-latest
steps:
- uses: cachix/install-nix-action@v22
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4
with:
repository: 'hyprwm/Hyprland'
ref: ${{ inputs.hyprland_rev }}
path: hyprland
- name: Get Hyprland commit SHA
run: |
pushd hyprland
HYPRLAND_COMMIT=$(git rev-parse HEAD)
echo "Commit SHA of hyprland revision '${{ inputs.hyprland_rev }}' is $HYPRLAND_COMMIT"
echo "HYPRLAND_COMMIT=$HYPRLAND_COMMIT" >> $GITHUB_ENV
popd
- uses: actions/checkout@v4
with:
ref: ${{ inputs.hyprgrass_rev }}
- name: Get Hyprland commit SHA
run: |
HYPRGRASS_COMMIT=$(git rev-parse HEAD)
echo "Commit SHA of hyprgrass revision '${{ inputs.hyprgrass_rev }}' is $HYPRGRASS_COMMIT"
echo "HYPRGRASS_COMMIT=$HYPRGRASS_COMMIT" >> $GITHUB_ENV
- name: build and test hyprgrass
run: |
nix build .#hyprgrassWithTests \
--override-input hyprland "${PWD}/hyprland" \
--option extra-substituters https://hyprland.cachix.org \
--option extra-trusted-public-keys hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=
- name: update commit pin and create pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if ! [ grep "$HYPRLAND_COMMIT" hyprpm.toml ]; do
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b "pr-hyprpm-pin-$(date +'%Y%m%d%H%M%S')" main
sed -i -e "/## DO NOT EDIT THIS LINE: auto-pin CI ##/i [\"$HYPRLAND_COMMIT\", \"$HYPRGRASS_COMMIT\"]" hyprpm.toml
git add hyprpm.toml
git commit -m 'ci: add hyprpm pin'
gh pr create --title "Automated PR: Add hyprpm pin" \
--body "This PR was created by a GitHub Actions workflow." \
--base main \
--head feature-branch
fi