Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eficode/resolve-pr-refs
Get the Git ref for comments on Pull Reguests
https://github.com/eficode/resolve-pr-refs
git github-actions
Last synced: 6 days ago
JSON representation
Get the Git ref for comments on Pull Reguests
- Host: GitHub
- URL: https://github.com/eficode/resolve-pr-refs
- Owner: eficode
- Created: 2021-11-16T14:13:20.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T06:25:05.000Z (2 months ago)
- Last Synced: 2024-11-04T14:45:37.423Z (8 days ago)
- Topics: git, github-actions
- Language: TypeScript
- Homepage:
- Size: 1.15 MB
- Stars: 5
- Watchers: 6
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Github Action Resolve Pull Request Refs
When your workflow triggers on a comment on PR (the `issue_comment`-event), you can use this action to resolve the Git ref for that pull-request.
## Inputs
### `token`
**Required:** Github API Token## Outputs
### `base_ref`
Pull request base ref.### `base_sha`
The SHA hash of the base ref.### `head_ref`
Pull request head ref.### `head_sha`
The SHA hash of the head ref.## Usage
### Example usage
```yaml
- name: resolve pr refs
id: refs
uses: eficode/resolve-pr-refs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
```### Example usecase
```yaml
on:
issue_comment:
types: [created]
jobs:
fast_forward_merge:
name: ff-merge
if: ${{ github.event.comment.body == '/ff-merge' }}
runs-on: ubuntu-latest
steps:
- name: resolve pr refs
id: refs
uses: eficode/resolve-pr-refs@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: checkout base
uses: actions/checkout@v2
with:
ref: ${{ steps.refs.outputs.base_ref }}
- name: fast forward merge pr
env:
HEAD_REF: ${{ steps.refs.outputs.head_ref }}
run: |
git fetch
git merge --ff-only origin/$HEAD_REF
git push
```## Contributing
Create a PR against this repository. To test your changes, comment `/test` on your PR.
## Building a new version
### Ensure vercel/ncc is installed
```
npm i -g @vercel/ncc
```### Compile
```
ncc build index.js --license licenses.txt
```### Tag
```
git tag -a -m "Amazing new release" v1.1
git push --follow-tags
```