name: Mark issue as planned

on:
  issues:
    types: [ milestoned ]

jobs:
  apply-label:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/github-script@v6
        name: Add label 'status planned' to issue when milestoned
        with:
          github-token: ${{github.token}}
          script: |
            github.rest.issues.addLabels({
              ...context.repo,
              issue_number: context.issue.number,
              labels: ['status: planned']
            })
            .catch(e => { console.log(e.message) })
      - uses: actions/github-script@v6
        name: Remove label 'status new' to issue when milestoned
        with:
          github-token: ${{github.token}}
          script: |
            github.rest.issues.removeLabel({
              ...context.repo,
              issue_number: context.issue.number,
              name: 'status: new'
            })
            .catch(e => { console.log(e.message) })

name: Mark issue as planned

on:
  issues:
    types: [ milestoned ]

jobs:
  apply-label:
    runs-on: ubuntu-20.04
    steps:
      - name: sleep 20s
        run: sleep 20
      - uses: actions/github-script@v6
        name: Add label 'status planned' to issue when milestoned
        with:
          github-token: ${{github.token}}
          script: |
            github.rest.issues.addLabels({
              ...context.repo,
              issue_number: context.issue.number,
              labels: ['status: planned']
            })
            .catch(e => { console.log(e.message) })
      - uses: actions/github-script@v6
        name: Remove label 'status new' to issue when milestoned
        with:
          github-token: ${{github.token}}
          script: |
            github.rest.issues.removeLabel({
              ...context.repo,
              issue_number: context.issue.number,
              name: 'status: new'
            })
            .catch(e => { console.log(e.message) })

Add sleep of 20s for planned milestones to reduce risk of race condition with...
Add sleep of 20s for planned milestones to reduce risk of race condition with...

... deplanning and both actions are running at the same time
