Plot out "events" on average df/f graph #9
This file contains hidden or 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: Create Asana Task from Issue | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| create-asana-task: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install asana | |
| run: pip install asana | |
| - name: Create Asana Task | |
| env: | |
| ASANA_TOKEN: ${{ secrets.ASANA_TOKEN }} | |
| ISSUE_TITLE: ${{ github.event.issue.title }} | |
| ISSUE_BODY: ${{ github.event.issue.body }} | |
| ISSUE_URL: ${{ github.event.issue.html_url }} | |
| ISSUE_CREATOR: ${{ github.event.issue.user.login }} | |
| run: | | |
| python - <<EOF | |
| import os | |
| import json | |
| import asana | |
| configuration = asana.Configuration() | |
| configuration.access_token = os.environ['ASANA_TOKEN'] | |
| api_client = asana.ApiClient(configuration) | |
| tasks_api_instance = asana.TasksApi(api_client) | |
| issues_parent_task_gid = '1211152257319662' | |
| assignee_gid = '1204867663578255' | |
| # Look up the issue creator in the GitHub-to-Asana user mapping | |
| creator_github = os.environ.get('ISSUE_CREATOR', '') | |
| creator_asana_gid = None | |
| try: | |
| with open('.github/github-to-asana-users.json') as f: | |
| user_map = json.load(f) | |
| creator_asana_gid = user_map.get(creator_github) | |
| if creator_asana_gid: | |
| print(f"Mapped GitHub user '{creator_github}' to Asana GID '{creator_asana_gid}'") | |
| else: | |
| print(f"No Asana mapping found for GitHub user '{creator_github}', skipping collaborator") | |
| except FileNotFoundError: | |
| print("User mapping file not found, skipping collaborator") | |
| body = { | |
| "data": { | |
| "name": os.environ['ISSUE_TITLE'], | |
| "notes": f"{os.environ.get('ISSUE_BODY', '')}\n\nGitHub Issue: {os.environ['ISSUE_URL']}", | |
| **({"assignee": assignee_gid} if assignee_gid else {}), | |
| **({"followers": [creator_asana_gid]} if creator_asana_gid else {}), | |
| } | |
| } | |
| result = tasks_api_instance.create_subtask_for_task(body, issues_parent_task_gid, {}) | |
| print(f"Asana subtask created successfully! Task GID: {result['gid']}") | |
| EOF |