forked from newrelic/repolinter-action
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.65 KB
/
send-pull-request.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: "Repository Hygiene Check"
on:
push:
branches:
- 'main'
workflow_dispatch:
jobs:
check-first-run:
name: Check For First Run
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check.outputs.should_run }}
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- id: check
run: |
# If manually triggered, always run
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "should_run=true" >> $GITHUB_OUTPUT
exit 0
fi
# Check if initialization label exists
has_label=$(gh label list --json name | jq '.[] | select(.name=="repolinter-initialized")')
if [[ -z "$has_label" ]]; then
# First time - create label and allow run
gh label create repolinter-initialized --description "Marks repo as having run initial repolinter check"
echo "should_run=true" >> $GITHUB_OUTPUT
else
echo "should_run=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repolinter-checks:
name: Tier 2 Checks
needs: check-first-run
if: needs.check-first-run.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- run: echo $RAW_JSON > repolinter.json
- uses: DSACMS/repolinter-action@main
with:
output_type: 'pull-request'
pull_request_labels: 'repolinter-initialized, cms-oss, cms-gov'
token: ${{ secrets.REPOLINTER_AUTO_TOKEN }}