Update xcm coefficients #139
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update xcm coefficients | |
on: | |
schedule: | |
- cron: '0 8 1/3 * *' | |
workflow_dispatch: | |
inputs: | |
environment: | |
required: true | |
description: Which file will be updated DEV or PROD | |
type: choice | |
default: PROD | |
options: | |
- DEV | |
- PROD | |
jobs: | |
update-xcm: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current repository to Master branch | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set environment | |
run: | | |
if [ "${{ github.event.inputs.environment }}" = "PROD" ]; then | |
echo "ENVIRONMENT=PROD" >> "$GITHUB_ENV" | |
else | |
echo "ENVIRONMENT=DEV" >> "$GITHUB_ENV" | |
fi | |
- name: Checkout support repo | |
uses: actions/checkout@v2 | |
with: | |
path: ./support | |
repository: nova-wallet/support-utils | |
ref: master | |
token: ${{ secrets.PAT_TOKEN }} | |
- name: 🛠 Set up actual paths | |
uses: ./.github/workflows/setup-path | |
- name: ⚙️ Install dependencies | |
run: | | |
cd ./support | |
make install | |
- name: 🦾 Generate new xcm coefficients | |
run: | | |
cd ./support | |
make update-xcm | |
- name: Move generated file | |
run: | | |
if [ "${{ github.event.inputs.environment }}" = "PROD" ]; then | |
mv support/transfers.json ${{ env.XCM_JSON_PATH }} | |
echo "COMMIT_FILE=${{ env.XCM_JSON_PATH }}" >> "$GITHUB_ENV" | |
echo "PR_REVIEWER=ERussel,leohar,valentunn,stepanLav" >> "$GITHUB_ENV" | |
else | |
mv support/transfers_dev.json ${{ env.DEV_XCM_JSON_PATH }} | |
echo "COMMIT_FILE=${{ env.DEV_XCM_JSON_PATH }}" >> "$GITHUB_ENV" | |
echo "PR_REVIEWER=leohar,stepanLav" >> "$GITHUB_ENV" | |
fi | |
- name: Make Pull Request | |
uses: ./.github/workflows/make-pull-request | |
with: | |
commit-files: ${{ env.COMMIT_FILE }} | |
commit-message: Update xcm coefficients | |
app-id: ${{ secrets.PR_APP_ID}} | |
app-token: ${{ secrets.PR_APP_TOKEN}} | |
pr-reviewer: ${{ env.PR_REVIEWER }} | |
branch-name: update-xcm-coefficients | |
pr-title: 🆙 Update XCM coefficients for ${{ env.ENVIRONMENT }} env | |
pr-body: This PR was generated automatically 🤖 | |
pr-base: master | |
alert: | |
runs-on: ubuntu-latest | |
needs: update-xcm | |
if: always() && (needs.update-xcm.result == 'failure') | |
env: | |
GITHUB_WORKFLOW_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
steps: | |
- name: Report | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
message: | | |
XCM update workflow failed, lets check: | |
Failed run: | |
${{ env.GITHUB_WORKFLOW_URL }} |