Fix unlabelling of "X-Needs-Info" (#30753)
* Fix broken unlabelled automation when removing labels if needs info is no longer in the labels we move it from the needs info column to the triage column * Remove unneeded param * make action id more specific
This commit is contained in:
53
.github/workflows/triage-unlabelled.yml
vendored
53
.github/workflows/triage-unlabelled.yml
vendored
@@ -5,44 +5,31 @@ on:
|
|||||||
types: [unlabeled]
|
types: [unlabeled]
|
||||||
permissions: {}
|
permissions: {}
|
||||||
jobs:
|
jobs:
|
||||||
Move_Unabeled_Issue_On_Project_Board:
|
move_no_longer_needs_info_issues:
|
||||||
name: Move no longer X-Needs-Info issues to Triaged
|
name: Move no longer X-Needs-Info issues to Triaged
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
permissions:
|
|
||||||
repository-projects: read
|
|
||||||
if: >
|
if: >
|
||||||
${{
|
!contains(github.event.issue.labels.*.name, 'X-Needs-Info')
|
||||||
!contains(github.event.issue.labels.*.name, 'X-Needs-Info') }}
|
|
||||||
env:
|
|
||||||
BOARD_NAME: "Issue triage"
|
|
||||||
OWNER: ${{ github.repository_owner }}
|
|
||||||
REPO: ${{ github.event.repository.name }}
|
|
||||||
ISSUE: ${{ github.event.issue.number }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check if issue is already in "${{ env.BOARD_NAME }}"
|
- id: add_to_project
|
||||||
run: |
|
uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
|
||||||
json=$(curl -s -H 'Content-Type: application/json' -H "Authorization: bearer ${{ secrets.GITHUB_TOKEN }}" -X POST -d '{"query": "query($issue: Int!, $owner: String!, $repo: String!) { repository(owner: $owner, name: $repo) { issue(number: $issue) { projectCards { nodes { project { name } isArchived } } } } } ", "variables" : "{ \"issue\": '${ISSUE}', \"owner\": \"'${OWNER}'\", \"repo\": \"'${REPO}'\" }" }' https://api.github.com/graphql)
|
|
||||||
if echo $json | jq '.data.repository.issue.projectCards.nodes | length'; then
|
|
||||||
if [[ $(echo $json | jq '.data.repository.issue.projectCards.nodes[0].project.name') =~ "${BOARD_NAME}" ]]; then
|
|
||||||
if [[ $(echo $json | jq '.data.repository.issue.projectCards.nodes[0].isArchived') == 'true' ]]; then
|
|
||||||
echo "Issue is already in Project '$BOARD_NAME', but is archived - skipping workflow";
|
|
||||||
echo "SKIP_ACTION=true" >> $GITHUB_ENV
|
|
||||||
else
|
|
||||||
echo "Issue is already in Project '$BOARD_NAME', proceeding";
|
|
||||||
echo "ALREADY_IN_BOARD=true" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Issue is not in project '$BOARD_NAME', cancelling this workflow"
|
|
||||||
echo "ALREADY_IN_BOARD=false" >> $GITHUB_ENV
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
- name: Move issue
|
|
||||||
uses: alex-page/github-project-automation-plus@303f24a24c67ce7adf565a07e96720faf126fe36
|
|
||||||
if: ${{ env.ALREADY_IN_BOARD == 'true' && env.SKIP_ACTION != 'true' }}
|
|
||||||
with:
|
with:
|
||||||
project: Issue triage
|
project-url: ${{ env.PROJECT_URL }}
|
||||||
column: Triaged
|
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||||
repo-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
|
||||||
|
- id: set_fields
|
||||||
|
uses: nipe0324/update-project-v2-item-field@c4af58452d1c5a788c1ea4f20e073fa722ec4a6b #v2.0.2
|
||||||
|
with:
|
||||||
|
project-url: ${{ env.PROJECT_URL }}
|
||||||
|
github-token: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
||||||
|
skip-update-script: |
|
||||||
|
const isIssue = item.type === 'ISSUE'
|
||||||
|
const status = item.fieldValues['Status']
|
||||||
|
return !isIssue || status !== 'Needs info'
|
||||||
|
field-name: Status
|
||||||
|
field-value: "Triaged"
|
||||||
|
env:
|
||||||
|
PROJECT_URL: https://github.com/orgs/element-hq/projects/120
|
||||||
|
|
||||||
remove_Z-Labs_label:
|
remove_Z-Labs_label:
|
||||||
name: Remove Z-Labs label when features behind labs flags are removed
|
name: Remove Z-Labs label when features behind labs flags are removed
|
||||||
|
|||||||
Reference in New Issue
Block a user