-
Notifications
You must be signed in to change notification settings - Fork 6
80 lines (74 loc) · 2.31 KB
/
update.yml
File metadata and controls
80 lines (74 loc) · 2.31 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
---
name: Update
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
concurrency:
group: update
cancel-in-progress: true
jobs:
update:
runs-on: macos-latest
permissions:
contents: write
id-token: write
pull-requests: write
steps:
- name: Create GH App token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Checkout code
uses: actions/checkout@v6
with:
ref: main
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Install devenv
run: nix profile add --accept-flake-config github:cachix/devenv/latest
- name: Compile cli
run: devenv shell -- go build .
working-directory: cli
- name: Update versions
id: update
run: |
commit_message=$(cli/cli update)
echo "commit_message=$commit_message" >> "$GITHUB_OUTPUT"
env:
CLI_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Create pull request
if: ${{ steps.update.outputs.commit_message }}
uses: peter-evans/create-pull-request@v8
with:
commit-message: ${{ steps.update.outputs.commit_message }}
title: ${{ steps.update.outputs.commit_message }}
body: |
Automatically created pull-request to update Terraform versions.
This is the result of configuring a CLI_GITHUB_TOKEN in `.env` and running:
```sh
pushd cli
go build .
popd
cli/cli update
```
delete-branch: true
reviewers: |
oscar-izval
sestrella
token: ${{ steps.app-token.outputs.token }}
notify:
if: failure()
runs-on: ubuntu-latest
needs: [update]
steps:
- uses: slackapi/slack-github-action@v2
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: webhook-trigger
payload: |
{
"text": "*nixpkgs-terraform*: :elmofire: *${{ github.workflow }}* workflow failed on *${{ github.ref_name }}* (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|open run>)"
}