Repository navigation
91 lines (79 loc) · 3.17 KB
/
Copy pathdata-bump.yml
File metadata and controls
91 lines (79 loc) · 3.17 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
85
86
87
88
89
90
91
name: internacia-db data bump
# Opens a pull request that runs the tests against a new internacia-db release and merges it
# automatically when CI passes and the contract major is unchanged. internacia-db's release.yml
# sends the dispatch; the daily schedule catches anything it missed.
#
# Needs the internacia-bot GitHub App (INTERNACIA_BOT_CLIENT_ID / INTERNACIA_BOT_PRIVATE_KEY,
# Contents and Pull requests write): pull requests opened with GITHUB_TOKEN do not run CI.
# Auto-merge also needs "Allow auto-merge" and branch protection on main requiring the CI checks.
on:
schedule:
- cron: '30 6 * * *'
repository_dispatch:
types: [internacia-db-release]
workflow_dispatch:
inputs:
version:
description: internacia-db release (blank = latest)
required: false
permissions:
contents: read
concurrency:
group: data-bump
cancel-in-progress: false
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install the SDK
run: pip install -e .
- name: Check for a newer internacia-db release
id: bump
env:
VERSION: ${{ github.event.client_payload.version || inputs.version }}
run: python scripts/data_bump.py ${VERSION:+--version "$VERSION"} --pr-body data-bump.md
- name: Check bot app secrets
if: steps.bump.outputs.changed == 'true'
env:
CLIENT_ID: ${{ secrets.INTERNACIA_BOT_CLIENT_ID }}
PRIVATE_KEY: ${{ secrets.INTERNACIA_BOT_PRIVATE_KEY }}
run: |
if [ -z "$CLIENT_ID" ] || [ -z "$PRIVATE_KEY" ]; then
echo "::error::INTERNACIA_BOT_CLIENT_ID / INTERNACIA_BOT_PRIVATE_KEY are not set; cannot open the data-bump PR for internacia-db ${{ steps.bump.outputs.version }}."
exit 1
fi
- name: Mint bot app token
id: app-token
if: steps.bump.outputs.changed == 'true'
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.INTERNACIA_BOT_CLIENT_ID }}
private-key: ${{ secrets.INTERNACIA_BOT_PRIVATE_KEY }}
permission-contents: write
permission-pull-requests: write
- name: Open the data-bump PR
id: cpr
if: steps.bump.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ steps.app-token.outputs.token }}
branch: data-bump/internacia-db
commit-message: "test: internacia-db ${{ steps.bump.outputs.version }}"
title: "Test against internacia-db ${{ steps.bump.outputs.version }}"
labels: data-bump
body-path: data-bump.md
add-paths: |
tests/internacia-db.json
internacia/contract.py
README.md
- name: Enable auto-merge
if: steps.cpr.outputs.pull-request-number && steps.bump.outputs.auto_merge == 'true'
continue-on-error: true
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
PR: ${{ steps.cpr.outputs.pull-request-number }}
run: gh pr merge "$PR" --auto --squash --repo "$GITHUB_REPOSITORY"