name: Add all issues and PRs to F# project, assign milestone and labels on: issues: types: - opened - transferred pull_request_target: types: - opened branches: ['main'] permissions: issues: write repository-projects: write jobs: cleanup_old_runs: runs-on: ubuntu-20.04 if: github.event_name != 'pull_request_target' permissions: actions: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Delete old workflow runs run: | _UrlPath="/repos/$GITHUB_REPOSITORY/actions/workflows" _CurrentWorkflowID="$(gh api -X GET "$_UrlPath" | jq '.workflows[] | select(.name == '\""$GITHUB_WORKFLOW"\"') | .id')" gh api -X GET "$_UrlPath/$_CurrentWorkflowID/runs" --paginate \ | jq '.workflow_runs[] | select(.status == "completed") | .id' \ | xargs -I{} gh api -X DELETE "/repos/$GITHUB_REPOSITORY/actions/runs"/{} apply-label: runs-on: ubuntu-latest if: github.event_name != 'pull_request_target' steps: - uses: actions/github-script@v6 with: script: | github.rest.issues.addLabels({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, labels: ['Needs-Triage'] }) apply-milestone: runs-on: ubuntu-latest if: github.event_name != 'pull_request_target' steps: - uses: actions/github-script@v6 with: script: | github.rest.issues.update({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, milestone: 29 })