forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (55 loc) · 1.73 KB
/
add_to_project.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
})