Skip to content

Commit

Permalink
v3 (#823)
Browse files Browse the repository at this point in the history
* convert to composite action

* fix readme

* fix step name
  • Loading branch information
peter-evans committed Apr 6, 2023
1 parent 2402de7 commit 67d9b39
Show file tree
Hide file tree
Showing 18 changed files with 75 additions and 24,254 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

12 changes: 0 additions & 12 deletions .github/dependabot.yml
Expand Up @@ -7,15 +7,3 @@ updates:
day: "saturday"
labels:
- "dependencies"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
day: "saturday"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
labels:
- "dependencies"

94 changes: 0 additions & 94 deletions .github/workflows/ci-test-command.yml

This file was deleted.

58 changes: 8 additions & 50 deletions .github/workflows/ci.yml
Expand Up @@ -20,18 +20,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npm ci
- run: npm run build
- run: npm run format-check
- run: npm run lint
- run: npm run test
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- uses: actions/upload-artifact@v3
with:
name: action.yml
Expand All @@ -40,21 +28,15 @@ jobs:
test:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
needs: [build]
runs-on: ubuntu-latest
strategy:
matrix:
target: [built, committed]
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
ref: main
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- if: matrix.target == 'built' || github.event_name == 'pull_request'
uses: actions/download-artifact@v3
- uses: actions/download-artifact@v3
with:
name: action.yml
path: .
Expand All @@ -66,43 +48,19 @@ jobs:
id: cpr
uses: peter-evans/create-pull-request@v4
with:
commit-message: '[CI] test ${{ matrix.target }}'
title: '[CI] test ${{ matrix.target }}'
commit-message: '[CI] test ${{ matrix.os }}'
title: '[CI] test ${{ matrix.os }}'
body: |
- CI test case for target '${{ matrix.target }}'
- CI test case for target '${{ matrix.os }}'
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: ci-test-${{ matrix.target }}-${{ github.sha }}
branch: ci-test-${{ matrix.os }}-${{ github.sha }}

- name: Close Pull
uses: ./
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
comment: '[CI] test ${{ matrix.target }}'
comment: '[CI] test ${{ matrix.os }}'
delete-branch: true

package:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
commit-message: Update distribution
title: Update distribution
body: |
- Updates the distribution for changes on `main`
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: update-distribution
5 changes: 0 additions & 5 deletions .github/workflows/slash-command-dispatch.yml
Expand Up @@ -17,10 +17,5 @@ jobs:
"permission": "admin",
"repository": "peter-evans/slash-command-dispatch-processor",
"issue_type": "pull-request"
},
{
"command": "ci-test",
"permission": "admin",
"issue_type": "pull-request"
}
]
32 changes: 32 additions & 0 deletions .github/workflows/update-major-version.yml
@@ -0,0 +1,32 @@
name: Update Major Version
run-name: Update ${{ github.event.inputs.main_version }} to ${{ github.event.inputs.target }}

on:
workflow_dispatch:
inputs:
target:
description: The target tag or reference
required: true
main_version:
type: choice
description: The major version tag to update
options:
- v2
- v3

jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
fetch-depth: 0
- name: Git config
run: |
git config user.name actions-bot
git config user.email actions-bot@users.noreply.github.com
- name: Tag new target
run: git tag -f ${{ github.event.inputs.main_version }} ${{ github.event.inputs.target }}
- name: Push new tag
run: git push origin ${{ github.event.inputs.main_version }} --force
2 changes: 0 additions & 2 deletions .gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

11 changes: 0 additions & 11 deletions .prettierrc.json

This file was deleted.

14 changes: 12 additions & 2 deletions README.md
Expand Up @@ -6,11 +6,21 @@ A GitHub action to close a pull request and optionally delete its branch.

## Usage

### Close a pull request and delete its branch
| :exclamation: Using this action is no longer necessary |
|-----------------------------------------------------------|

The same functionality exists in the GitHub CLI. See the documentation [here](https://cli.github.com/manual/gh_pr_close).
```yml
- name: Close Pull
run: gh pr close --comment "Auto-closing pull request" --delete-branch "1"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

If you prefer to use this action:
```yml
- name: Close Pull
uses: peter-evans/close-pull@v2
uses: peter-evans/close-pull@v3
with:
pull-request-number: 1
comment: Auto-closing pull request
Expand Down
26 changes: 23 additions & 3 deletions action.yml
Expand Up @@ -16,8 +16,28 @@ inputs:
description: 'Delete the pull request branch'
default: false
runs:
using: 'node16'
main: 'dist/index.js'
using: composite
steps:
- name: Set Parameters
id: params
shell: bash
run: |
if [ -n "${{ inputs.comment }}" ]; then
echo comment="--comment \"${{ inputs.comment }}\"" >> $GITHUB_OUTPUT
fi
if [ "${{ inputs.delete-branch }}" = true ]; then
echo delete-branch="--delete-branch" >> $GITHUB_OUTPUT
fi
- name: Close Pull
shell: bash
run: |
gh pr close -R "${{ inputs.repository }}" \
${{ steps.params.outputs.comment }} \
${{ steps.params.outputs.delete-branch }} \
"${{ inputs.pull-request-number }}"
env:
GH_TOKEN: ${{ inputs.token }}
branding:
icon: 'slash'
icon: 'git-pull-request'
color: 'gray-dark'

0 comments on commit 67d9b39

Please sign in to comment.