Add a workflow to generate version bump PRs for the dashboard. (#11076)
Austin S. Hemmelgarn committed
May 6, 2021 at 10:46 UTC
673bd3a5026417af2b0ab029dbece0abe283accc
1 file changed
+50
.github/workflows/dashboard-pr.yml
new
+50
@@ -0,0 +1,50 @@
1
+---
2
+# Create a PR to update the react dashboard code.
3
+name: Dashboard Version PR
4
+
5
+on:
6
+ workflow_dispatch:
7
+ inputs:
8
+ dashboard_version:
9
+ # This must be specified, and must _exactly_ match the version
10
+ # tag for the release to be used for the update.
11
+ name: Dashboard Version
12
+ required: true
13
+
14
+jobs:
15
+ dashboard-pr:
16
+ name: Generate Dashboard Version Bump PR
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout
20
+ uses: actions/checkout@v2
21
+ - name: Create Branch
22
+ # This is needed because we want to do a PR, and the commit
23
+ # action used below requires the branch it is commiting to to
24
+ # already exist.
25
+ run: |
26
+ git checkout -b dashboard-${{ github.event.inputs.dashboard_version }}
27
+ git push -u origin dashboard-${{ github.event.inputs.dashboard_version }}
28
+ - name: Update Files
29
+ run: |
30
+ curl -o dashboard.tar.gz https://github.com/netdata/dashboard/releases/download/${{ github.event.inputs.dashboard_version }}/dashboard.tar.gz
31
+ echo ${{ github.event.inputs.dashboard_version }} > packaging/dashboard.version
32
+ sha256sum dashboard.tar.gz > packaging/dashboard.checksums
33
+ rm dashboard.tar.gz
34
+ - name: Commit Changes
35
+ uses: swinton/commit@v2.x
36
+ env:
37
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38
+ with:
39
+ files: |
40
+ packaging/dashboard.version
41
+ packaging/dashboard.checksums
42
+ commit-message: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.'
43
+ ref: refs/heads/dashboard-${{ github.event.inputs.dashboard_version }}
44
+ - name: Create PR
45
+ uses: repo-sync/pull-request@v2
46
+ with:
47
+ source_branch: dashboard-${{ github.event.inputs.dashboard_version }}
48
+ pr_title: 'Update dashboard to version ${{ github.event.inputs.dashboard_version }}.'
49
+ pr_body: 'See https://github.com/netdata/dashboard/releases/tag/${{ github.event.inputs.dashboard_version }} for changes.'
50
+ github_token: ${{ secrets.GITHUB_TOKEN }}