Skip to content

Commit 3cd3bb0

Browse files
authored
v3 (#800)
* convert to composite action * refactor
1 parent b1c15b9 commit 3cd3bb0

16 files changed

Lines changed: 68 additions & 24324 deletions

.eslintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,3 @@ updates:
77
day: "wednesday"
88
labels:
99
- "dependencies"
10-
11-
- package-ecosystem: "npm"
12-
directory: "/"
13-
schedule:
14-
interval: "weekly"
15-
day: "wednesday"
16-
ignore:
17-
- dependency-name: "*"
18-
update-types: ["version-update:semver-major"]
19-
labels:
20-
- "dependencies"
21-

.github/workflows/ci.yml

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,6 @@ jobs:
2121
runs-on: ubuntu-latest
2222
steps:
2323
- uses: actions/checkout@v3
24-
- uses: actions/setup-node@v3
25-
with:
26-
node-version: 16.x
27-
cache: npm
28-
- run: npm ci
29-
- run: npm run build
30-
- run: npm run format-check
31-
- run: npm run lint
32-
- run: npm run test
33-
- uses: actions/upload-artifact@v3
34-
with:
35-
name: dist
36-
path: dist
3724
- uses: actions/upload-artifact@v3
3825
with:
3926
name: action.yml
@@ -42,61 +29,32 @@ jobs:
4229
test:
4330
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
4431
needs: [build]
45-
runs-on: ubuntu-latest
4632
strategy:
4733
matrix:
48-
target: [built, committed]
34+
os: [windows-latest, ubuntu-latest, macos-latest]
35+
runs-on: ${{ matrix.os }}
4936
steps:
5037
- uses: actions/checkout@v3
51-
- if: matrix.target == 'built' || github.event_name == 'pull_request'
52-
uses: actions/download-artifact@v3
53-
with:
54-
name: dist
55-
path: dist
56-
- if: matrix.target == 'built' || github.event_name == 'pull_request'
57-
uses: actions/download-artifact@v3
38+
- uses: actions/download-artifact@v3
5839
with:
5940
name: action.yml
6041
path: .
6142

6243
- name: Create issue content
63-
run: echo "#[CI] test ${{ matrix.target }}" > issue.md
44+
run: echo "#[CI] test ${{ matrix.os }}" > issue.md
6445

6546
- name: Test create issue from file
6647
id: ciff
6748
uses: peter-evans/create-issue-from-file@v4
6849
with:
69-
title: '[CI] test ${{ matrix.target }}'
50+
title: '[CI] test ${{ matrix.os }}'
7051
content-filepath: ./issue.md
7152

7253
- name: Close Issue
7354
uses: ./
7455
with:
7556
issue-number: ${{ steps.ciff.outputs.issue-number }}
76-
comment: '[CI] test ${{ matrix.target }}'
57+
comment: '[CI] test ${{ matrix.os }}'
7758
labels: |
7859
wontfix
79-
80-
package:
81-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
82-
needs: [test]
83-
runs-on: ubuntu-latest
84-
steps:
85-
- uses: actions/checkout@v3
86-
- uses: actions/download-artifact@v3
87-
with:
88-
name: dist
89-
path: dist
90-
- name: Create Pull Request
91-
uses: peter-evans/create-pull-request@v5
92-
with:
93-
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
94-
commit-message: Update distribution
95-
title: Update distribution
96-
body: |
97-
- Updates the distribution for changes on `main`
98-
99-
Auto-generated by [create-pull-request][1]
100-
101-
[1]: https://github.com/peter-evans/create-pull-request
102-
branch: update-distribution
60+
ci-test

.github/workflows/update-major-version.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ on:
1212
description: The major version tag to update
1313
options:
1414
- v2
15+
- v3
1516

1617
jobs:
1718
tag:

.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.prettierignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.prettierrc.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,21 @@ A GitHub action to close an issue.
66

77
## Usage
88

9+
| :exclamation: Using this action is no longer necessary |
10+
|-----------------------------------------------------------|
11+
12+
The same functionality exists in the GitHub CLI. See the documentation [here](https://cli.github.com/manual/gh_issue_close).
13+
```yml
14+
- name: Close Issue
15+
run: gh issue close --comment "Auto-closing issue" "1"
16+
env:
17+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
```
19+
20+
If you prefer to use this action:
921
```yml
1022
- name: Close Issue
11-
uses: peter-evans/close-issue@v2
23+
uses: peter-evans/close-issue@v3
1224
with:
1325
issue-number: 1
1426
comment: Auto-closing issue
@@ -28,7 +40,7 @@ jobs:
2840
steps:
2941
- if: startsWith(github.event.issue.title, 'ABC-') != 'true'
3042
name: Close Issue
31-
uses: peter-evans/close-issue@v2
43+
uses: peter-evans/close-issue@v3
3244
with:
3345
comment: |
3446
Issue title must start with 'ABC-'.
@@ -38,16 +50,14 @@ jobs:
3850
### Close issue and add label(s)
3951
```yml
4052
- name: Close Issue
41-
uses: peter-evans/close-issue@v2
53+
uses: peter-evans/close-issue@v3
4254
with:
4355
issue-number: 1
4456
comment: Auto-closing issue
4557
labels: |
4658
wontfix
4759
```
4860
49-
> Add multiple labels separated by comma
50-
5161
### Action inputs
5262
5363
| Name | Description | Default |

action.yml

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,50 @@ inputs:
2424
required: false
2525
description: 'A comma or newline separated list of labels.'
2626
runs:
27-
using: 'node16'
28-
main: 'dist/index.js'
27+
using: composite
28+
steps:
29+
- name: Set parameters
30+
id: params
31+
shell: bash
32+
run: |
33+
if [ -n "${{ inputs.comment }}" ]; then
34+
echo comment="--comment \"${{ inputs.comment }}\"" >> $GITHUB_OUTPUT
35+
fi
36+
37+
if [ "${{ inputs.close-reason }}" == "not_planned" ]; then
38+
echo close-reason="not planned" >> $GITHUB_OUTPUT
39+
else
40+
echo close-reason="completed" >> $GITHUB_OUTPUT
41+
fi
42+
43+
# Convert labels to comma separated list
44+
if [ -n "${{ inputs.labels }}" ]; then
45+
labels=$(echo "${{ inputs.labels }}" | tr '\n' ',' | sed 's/,$//')
46+
# Remove trailing comma and whitespace
47+
labels=$(echo $labels | sed 's/,$//' | sed 's/[[:space:]]//g')
48+
echo labels=$labels >> $GITHUB_OUTPUT
49+
fi
50+
51+
- name: Close Issue
52+
shell: bash
53+
run: |
54+
gh issue close -R "${{ inputs.repository }}" \
55+
--reason "${{ steps.params.outputs.close-reason }}" \
56+
${{ steps.params.outputs.comment }} \
57+
"${{ inputs.issue-number }}"
58+
env:
59+
GH_TOKEN: ${{ inputs.token }}
60+
61+
- name: Add Labels
62+
if: steps.params.outputs.labels != ''
63+
shell: bash
64+
run: |
65+
gh issue edit -R "${{ inputs.repository }}" \
66+
--add-label "${{ steps.params.outputs.labels }}" \
67+
"${{ inputs.issue-number }}"
68+
env:
69+
GH_TOKEN: ${{ inputs.token }}
70+
2971
branding:
30-
icon: 'slash'
72+
icon: 'git-pull-request'
3173
color: 'gray-dark'

0 commit comments

Comments
 (0)