generate-lists #1080
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: generate-lists | |
# Generate OFAC sanctioned digital currency addresses lists each night at 0 UTC | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# ensure permissions are explicitly defined | |
# by configuring one we disable the remaining permissions | |
# see: https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_idpermissions | |
# permissions: | |
# contents: read | |
# ensure multiple CI processes are not running analysis on contracts | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
PULL_NUMBER: ${{ github.event.pull_request.number }} | |
RUN_ID: ${{ github.run_id }} | |
FORCE_COLOR: 2 | |
jobs: | |
generate-lists: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | |
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Download the sdn_advanced.xml file | |
uses: wei/wget@v1 | |
with: | |
args: https://www.treasury.gov/ofac/downloads/sanctions/1.0/sdn_advanced.xml | |
- name: Generate TXT and JSON files for all assets | |
run: | | |
mkdir -p data | |
python3 generate-address-list.py XBT ETH XMR LTC ZEC DASH BTG ETC BSV -f JSON TXT -path ./data | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
- name: Test with environment variables | |
run: echo $TAG_NAME - $RELEASE_NAME | |
env: | |
TAG_NAME: tag-${{ steps.date.outputs.date }} | |
RELEASE_NAME: v-${{ steps.date.outputs.date }} | |
- name: Commit files | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
branch_date="$(date +'%Y-%m-%d')" | |
git switch -c ${branch_date} | |
mv data/* . | |
git add sanctioned_addresses_* -f | |
git commit -m "Automatically updated lists: $(date)" -a || true | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ steps.date.outputs.date }} | |
force: true | |
- uses: actions/checkout@v3 | |
- name: HandleIfFailure | |
if: failure() | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
filename: .github/exception-job-failed.md |