-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (51 loc) · 1.67 KB
/
update.yaml
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
name: Update package
on:
pull_request:
push:
branches: main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: iterative/setup-cml@v3
- name: get latest dvc version
id: latest
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: echo "version=$(./latest.sh)" >> $GITHUB_OUTPUT
- name: try update
id: update
shell: bash
run: |
echo latest version ${{ steps.latest.outputs.version }}
./update.sh ${{ steps.latest.outputs.version }}
echo "changes=$(git diff | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: create PR
if: ${{ steps.update.outputs.changes != '' && github.event_name != 'pull_request'}}
id: create-pr
run: |
cml pr create \
--token="${{ secrets.GITHUB_TOKEN }}" \
--message="dvc ${{ steps.latest.outputs.version }}" \
--title="dvc ${{ steps.latest.outputs.version }}" .
env:
GITHUB_TOKEN: ${{ secrets.OLIVAW_PAT }}
- name: Merge the PR
if: ${{ steps.update.outputs.changes != '' && github.event_name != 'pull_request'}}
run: gh pr merge --squash --delete-branch --auto ${{ steps.create-pr.outputs.pull-request-url }}
env:
GITHUB_TOKEN: ${{ secrets.OLIVAW_PAT }}
- name: Send message to slack
if: failure()
uses: rtCamp/[email protected]
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: ${{ job.status }}
SLACK_MESSAGE: 'Package update failed for ${{ github.repository }}'
SLACK_TITLE: CI Status
SLACK_USERNAME: dvc-pkg-update