-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (47 loc) · 1.7 KB
/
auto-labeler.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
name: hacktoberfest-labeler
on:
pull_request_target:
types: [opened, reopened, closed]
permissions:
contents: read
pull-requests: write
jobs:
auto-labeler:
runs-on: ubuntu-latest
steps:
- name: Check for hacktoberfest season
id: check-month
run: |
current_month=$(date +'%m')
if [ "$current_month" == "10" ]; then
echo "is_october=true" >> $GITHUB_OUTPUT
else
echo "is_october=false" >> $GITHUB_OUTPUT
fi
- name: Creating config file
env:
ACTION: ${{ github.event.action }}
MERGED: ${{ github.event.pull_request.merged }}
run: |
touch ./hacktoberfest-labeler.yml
echo "ACTION Value = $ACTION\n\n"
echo "MERGED Value = $MERGED\n\n"
if [ "$ACTION" == "opened" ]; then
echo "hacktoberfest:" > hacktoberfest-labeler.yml
elif [ "$MERGED" == "true" ]; then
echo "hacktoberfest-accepted:" > hacktoberfest-labeler.yml
else
echo "invalid:" > hacktoberfest-labeler.yml
fi
echo "- changed-files:" >> hacktoberfest-labeler.yml
echo " - any-glob-to-any-file: '**'" >> hacktoberfest-labeler.yml
echo "Created the config file:"
echo "------------------------"
cat ./hacktoberfest-labeler.yml
- name: Label the PRs
if: steps.check-month.outputs.is_october == 'true' ||
github.event.pull_request.merged == 'true' &&
contains(github.event.pull_request.labels.*.name, 'hacktoberfest')
uses: actions/[email protected]
with:
configuration-path: ./hacktoberfest-labeler.yml