iotempower
iotempower copied to clipboard
[GitHub Action] Auto-apply Todo/In Progress status to 'urgent' issues
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
:
- 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,
});
- Configure the workflow to trigger when an issue is labeled
- Find the Project Column ID:
3, Go to the GitHub Project board.
- Inspect the status column where you want to move issues (e.g., 'To Do' or 'In Progress').
- Find the column's
ID
through the GitHub API or by inspecting the page elements.
- 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.