Revert "feat: add ELDA token" #63
Workflow file for this run
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 config | |
on: | |
pull_request_target: | |
types: [closed] | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update-config: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CHAINS_PAT: ${{ secrets.CHAINS_PAT }} | |
EXTERNAL_REPO: ${{ secrets.EXTERNAL_REPO }} | |
steps: | |
- name: Checkout axelar-configs repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check if PR was merged | |
id: check_if_merged | |
run: | | |
if [ "${{ github.event.pull_request.merged }}" != "true" ]; then | |
echo "PR was not merged. Exiting." | |
exit 0 | |
fi | |
- name: Get the merge commit SHA | |
id: merge_commit | |
run: | | |
MERGE_COMMIT=$(git log -1 --pretty=format:"%H") | |
echo "MERGE_COMMIT=$MERGE_COMMIT" >> $GITHUB_ENV | |
- name: Determine NETWORK | |
id: determine_network | |
run: | | |
echo "Checking modified files in commit ${{ env.MERGE_COMMIT }}" | |
MODIFIED_FILES=$(git diff --name-only HEAD~1..HEAD) | |
echo "Modified files: $MODIFIED_FILES" | |
if echo "$MODIFIED_FILES" | grep -q "registry/mainnet/interchain/squid.tokenlist.json"; then | |
echo "NETWORK=mainnet" >> $GITHUB_ENV | |
elif echo "$MODIFIED_FILES" | grep -q "registry/testnet/interchain/squid.tokenlist.json"; then | |
echo "NETWORK=testnet" >> $GITHUB_ENV | |
else | |
echo "No relevant changes detected." | |
echo "NETWORK=none" >> $GITHUB_ENV | |
exit 0 | |
fi | |
- name: Checkout external repository | |
if: env.NETWORK != 'none' | |
uses: actions/checkout@v4 | |
with: | |
repository: axelarnetwork/${{ secrets.EXTERNAL_REPO }} | |
path: ${{ secrets.EXTERNAL_REPO }} | |
token: ${{ secrets.CHAINS_PAT }} | |
- name: Install jq | |
if: env.NETWORK != 'none' | |
run: sudo apt-get install -y jq | |
- name: Setup Branch Name | |
if: env.NETWORK != 'none' | |
id: branch-name | |
run: echo "::set-output name=branch::feat/config-update-$(date +'%Y-%m-%d-%H-%M-%S')" | |
- name: Create branch and generate config | |
if: env.NETWORK != 'none' | |
run: | | |
cd ${{ secrets.EXTERNAL_REPO }} | |
curl -sSL https://install.python-poetry.org | python3 - | |
poetry install | |
git config --local user.email "[email protected]" | |
git config --local user.name "devops" | |
git checkout -b ${{ steps.branch-name.outputs.branch }} | |
poetry run python generate.py --network ${{ env.NETWORK }} --generate-config | |
git add --all | |
git commit -m "create branch ${{ steps.branch-name.outputs.branch }}" | |
git push --set-upstream origin ${{ steps.branch-name.outputs.branch }} | |
- name: Create Pull Request | |
if: env.NETWORK != 'none' | |
id: create_pr | |
run: | | |
cd ${{ secrets.EXTERNAL_REPO }} | |
PR_TITLE="feat: update configurations for ${{ env.NETWORK }}" | |
PR_BODY="Auto-generated PR with updated configuration files" | |
PR_HEAD="${{ steps.branch-name.outputs.branch }}" | |
PR_BASE="main" | |
RESPONSE=$(curl -s -X POST \ | |
-H "Authorization: token ${{ secrets.CHAINS_PAT }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/axelarnetwork/${{ secrets.EXTERNAL_REPO }}/pulls \ | |
-d "{\"title\":\"$PR_TITLE\",\"body\":\"$PR_BODY\",\"head\":\"$PR_HEAD\",\"base\":\"$PR_BASE\"}") | |
PR_NUMBER=$(echo $RESPONSE | jq -r .number) | |
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | |
- name: Merge Pull Request | |
if: env.NETWORK != 'none' | |
run: | | |
PR_NUMBER=${{ env.PR_NUMBER }} | |
PR_TITLE="feat: update configurations for ${{ env.NETWORK }}" | |
curl -s -X PUT \ | |
-H "Authorization: token ${{ secrets.CHAINS_PAT }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/axelarnetwork/${{ secrets.EXTERNAL_REPO }}/pulls/$PR_NUMBER/merge \ | |
-d "{\"commit_title\":\"Merge PR #$PR_NUMBER: $PR_TITLE\",\"merge_method\":\"squash\"}" | |
- name: Publish configuration | |
if: env.NETWORK != 'none' | |
run: | | |
WORKFLOW_FILE="publish-${{ env.NETWORK }}-configs.yaml" | |
curl -X POST \ | |
-H "Authorization: token ${{ secrets.CHAINS_PAT }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
https://api.github.com/repos/axelarnetwork/${{ secrets.EXTERNAL_REPO }}/actions/workflows/$WORKFLOW_FILE/dispatches \ | |
-d '{"ref":"main"}' |