iotempire / iotempower

IoTempower is a framework and environment for making the Internet of Things (IoT) accessible for everyone
MIT License
24 stars 21 forks source link

[GitHub Action] Auto-apply Todo/In Progress status to 'urgent' issues #97

Open mbz4 opened 6 months ago

mbz4 commented 6 months ago

With GitHub Actions, we add more flexibility to create workflows that meet more advanced project needs. We can automate various processes and integrate with other GitHub features to streamline project management. Also, if we have specific permissions or restrictions, GitHub Actions offers a way to work around limitations while automating tasks effectively.

How to create a custom GitHub workflow that moves an issue to a specific project column when it's labeled urgent:

  1. In IoTempower repo, navigate to .github/workflows
    • Create a new file, e.g., move-urgent-issues.yml
    • Define the Workflow (example):

name: Move Urgent Issues
on:
  issues:
    types: [labeled]

jobs:
  move-urgent:
    if: github.event.label.name == 'urgent'
    runs-on: ubuntu-latest
    steps:
      - name: Get issue details
        id: issue
        uses: actions/github-script@v6
        with:
          script: |
            const issue_number = context.payload.issue.number;
            return { issue_number: issue_number };

      - name: Move issue to "ToDo" column
        uses: actions/github-script@v6
        with:
          script: |
            const issue_number = steps.issue.outputs.issue_number;
            const project_column_id = 'YOUR_PROJECT_COLUMN_ID';  # Get this ID from your GitHub Project
            await github.projects.moveProjectCard({
              card_id: issue_number,
              position: 'top',  # or 'bottom'
              column_id: project_column_id,
            });
  1. Configure the workflow to trigger when an issue is labeled
    • Find the Project Column ID:

3, Go to the GitHub Project board.

  1. Commit and Push / Pull Request
    • Add the new workflow file to the repo
    • Test by creating an issue and adding the urgent label to ensure it moves to the correct column.