Skip to content

Move new issues to triage #14

Move new issues to triage

Move new issues to triage #14

Workflow file for this run

name: Move new issues to triage
on:
issues:
types:
- opened
jobs:
update-discussion:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Extract Discussions Link from Issue Body
id: extract-link
run: |
echo "Extracting discussions link from issue body"
LINK=$(echo "${{ github.event.issue.body }}" | grep -o 'https://github.com/.*/discussions/[0-9]*')
if [ -z "$LINK" ]; then
echo "No discussion link found"
echo "::set-output name=discussion_link::"
else
echo "Discussion link found: $LINK"
echo "::set-output name=discussion_link::$LINK"
fi
- name: Add Label to Discussion
if: steps.extract-link.outputs.discussion_link != ''
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
export DISCUSSION_URL="${{ steps.extract-link.outputs.discussion_link }}"
export DISCUSSION_ID=$(echo "$DISCUSSION_URL" | grep -o '[0-9]*$')
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/discussions/$DISCUSSION_ID/labels \
-d '{"labels":["${{ vars.TRANSFERRED_LABEL }}"]}'
transfer_issue:
if: ${{ ! contains(github.event.issue.labels.*.name, vars.KEEP_LABEL ) }}
needs: update-discussion
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: gh issue transfer "$ISSUE" datacite/product-suggestions-triage
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GH_REPO: ${{ github.repository }}
ISSUE: ${{ github.event.issue.html_url }}