-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (68 loc) · 2.69 KB
/
update-papi.yml
File metadata and controls
84 lines (68 loc) · 2.69 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
name: Update Polkadot API
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
check-updates:
runs-on: ubuntu-latest
outputs:
has_updates: ${{ steps.check-version.outputs.has_updates }}
new_version: ${{ steps.check-version.outputs.new_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- name: Get current Polkadot API version
id: current-version
run: |
CURRENT_VERSION=$(npm list polkadot-api --json | jq -r '.dependencies."polkadot-api".version')
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- name: Check latest Polkadot API version
id: check-version
run: |
LATEST_VERSION=$(npm view polkadot-api version)
echo "Latest version: $LATEST_VERSION"
echo "Current version: ${{ steps.current-version.outputs.current_version }}"
if [ "$LATEST_VERSION" != "${{ steps.current-version.outputs.current_version }}" ]; then
echo "has_updates=true" >> $GITHUB_OUTPUT
echo "new_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
else
echo "has_updates=false" >> $GITHUB_OUTPUT
fi
update-papi:
needs: check-updates
if: needs.check-updates.outputs.has_updates == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'
- name: Update Polkadot API
run: |
npm install polkadot-api@${{ needs.check-updates.outputs.new_version }}
npx papi
- name: Run tests
run: npm test
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update Polkadot API to v${{ needs.check-updates.outputs.new_version }}"
title: "Update Polkadot API to v${{ needs.check-updates.outputs.new_version }}"
body: |
This PR updates Polkadot API to v${{ needs.check-updates.outputs.new_version }}.
- Automatically generated by GitHub Actions
- The descriptors have been regenerated using `papi`
Please verify the changes and merge if all tests pass.
branch: "update-papi-v${{ needs.check-updates.outputs.new_version }}"
base: main
labels: dependencies,automated