Commit 8feacfa0 authored by tom goriunov's avatar tom goriunov Committed by GitHub

Merge pull request #993 from blockscout/tom2drum/issue-974

PM workflows improvements
parents 1cba69fe 99d570c1
name: Project management
on:
issues:
types: [ closed ]
pull_request:
types: [ review_requested ]
jobs:
not_planned_issue:
name: Update task for not planned issue
if: ${{ github.event.issue && github.event.action == 'closed' && github.event.issue.state_reason == 'not_planned' }}
uses: './.github/workflows/update-project-cards.yml'
with:
project_name: ${{ vars.PROJECT_NAME }}
field_name: Status
field_value: Done
issues: "[${{ github.event.issue.number }}]"
secrets: inherit
completed_issue:
name: Update task for completed issue
if: ${{ github.event.issue && github.event.action == 'closed' && github.event.issue.state_reason == 'completed' }}
uses: './.github/workflows/update-project-cards.yml'
with:
project_name: ${{ vars.PROJECT_NAME }}
field_name: Status
field_value: Ready For Realease
issues: "[${{ github.event.issue.number }}]"
secrets: inherit
review_requested:
name: Update tasks when review is requested
runs-on: ubuntu-latest
if: ${{ github.event.pull_request && github.event.action == 'review_requested' }}
steps:
- name: Fetching issues linked to pull request
id: linked_issues
uses: actions/github-script@v6
env:
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
with:
script: |
const response = await github.graphql(`
query ($owner: String!, $repo: String!, $pr: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
number
title
closingIssuesReferences(first: 100) {
nodes {
number
title
closed
}
}
}
}
}
`, {
owner: context.repo.owner,
repo: context.repo.repo,
pr: process.env.PULL_REQUEST_NUMBER,
});
const { repository: { pullRequest: { closingIssuesReferences } } } = response;
const issues = closingIssuesReferences.nodes.map(({ number }) => number);
if (!issues.length) {
core.notice(`No linked issues found for pull request #${ process.env.PULL_REQUEST_NUMBER }`);
return;
}
core.info(`Found ${ issues.length } issue(s): ${ issues.join(', ') || '-' }`);
return issues;
- name: Updating project task statuses for found issues
if: ${{ steps.linked_issues.outputs.result }}
uses: './.github/workflows/update-project-cards.yml'
with:
project_name: ${{ vars.PROJECT_NAME }}
field_name: Status
field_value: Review
issues: ${{ steps.linked_issues.outputs.result }}
......@@ -19,7 +19,7 @@ jobs:
needs: label_released_issues
uses: './.github/workflows/update-project-cards.yml'
with:
project_name: Front-end tasks
project_name: ${{ vars.PROJECT_NAME }}
field_name: Status
field_value: Released
issues: ${{ needs.label_released_issues.outputs.issues }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment