Merge Develop to Staging v24.40.0 #7271
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Label WIP | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
- edited | |
- closed | |
jobs: | |
check-linked-issues: | |
if: github.repository == 'ohcnetwork/care_fe' | |
name: Check linked issues | |
runs-on: ubuntu-latest | |
outputs: | |
linked_issues: ${{ steps.issue-output.outputs.linked_issues }} | |
steps: | |
- name: Get issues | |
id: get-issues | |
uses: mondeja/pr-linked-issues-action@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set output | |
id: issue-output | |
run: echo "linked_issues=${{ steps.get-issues.outputs.issues }}" >> $GITHUB_OUTPUT | |
label-issues: | |
name: Label linked issues | |
runs-on: ubuntu-latest | |
needs: check-linked-issues | |
permissions: write-all | |
if: github.repository == 'ohcnetwork/care_fe' && join(needs.check-linked-issues.outputs.linked_issues) != '' | |
steps: | |
- name: Label | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const issues = "${{ needs.check-linked-issues.outputs.linked_issues }}".split(',') | |
for (const issue of issues) { | |
if ("${{ github.event.pull_request.state }}" == "open") | |
github.rest.issues.addLabels({ | |
issue_number: issue, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["work-in-progress"] | |
}) | |
else | |
github.rest.issues.removeLabel({ | |
issue_number: issue, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ["work-in-progress"] | |
}) | |
} |