-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathaction.yml
More file actions
91 lines (83 loc) · 2.93 KB
/
action.yml
File metadata and controls
91 lines (83 loc) · 2.93 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
name: 'PR Triage Board Bot'
description: 'A GitHub Action to manage a GitHub Project board for PR triage'
author: 'yuvipanda'
branding:
icon: 'list'
color: 'blue'
inputs:
organization:
description: 'GitHub organization name'
required: true
project-number:
description: 'GitHub Project board number'
required: true
gh-app-id:
description: 'GitHub App ID for authentication'
required: true
gh-app-installation-id:
description: 'GitHub App Installation ID for authentication'
required: true
gh-app-private-key:
description: 'GitHub App private key (PEM format) for authentication'
required: true
repositories:
description: >
Comma-separated list of repository names to limit querying to
(optional). Example: repo1,repo2,repo3
required: false
node-version:
description: 'Node.js version to use'
required: false
default: '23.x'
runs:
using: 'composite'
steps:
# See https://github.com/actions/toolkit/issues/1035 for a discussion of why we need
# to copy package-lock.json to the WORKSPACE directory for npm caching to work. Basically,
# the hashFiles only works on files in the WORKSPACE directory.
- name: copy package-lock.json to WORKSPACE directory so the setup-node caching works
run: cp ${{ github.action_path }}/package-lock.json pr-triage-bot-package-lock.json
shell: bash
- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: ${{ inputs.node-version }}
cache-dependency-path: pr-triage-bot-package-lock.json
- name: Install dependencies
run: npm ci
shell: bash
working-directory: ${{ github.action_path }}
- name: Build project
run: npm run build
shell: bash
working-directory: ${{ github.action_path }}
- name: Setup GitHub App Private Key
run: |
echo "${{ inputs.gh-app-private-key }}" > private-key.pem
shell: bash
working-directory: ${{ github.action_path }}
- name: Run PR Triage Bot
run: |
if [ -n "${{ inputs.repositories }}" ]; then
node dist/src/main.js \
--gh-app-id ${{ inputs.gh-app-id }} \
--gh-app-installation-id ${{ inputs.gh-app-installation-id }} \
--gh-app-pem-file private-key.pem \
--repositories "${{ inputs.repositories }}" \
${{ inputs.organization }} ${{ inputs.project-number }}
else
node dist/src/main.js \
--gh-app-id ${{ inputs.gh-app-id }} \
--gh-app-installation-id ${{ inputs.gh-app-installation-id }} \
--gh-app-pem-file private-key.pem \
${{ inputs.organization }} ${{ inputs.project-number }}
fi
shell: bash
working-directory: ${{ github.action_path }}
- name: Cleanup private key
run: rm -f private-key.pem
shell: bash
if: ${{ always() }}
working-directory: ${{ github.action_path }}