-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 50ba0d1
Showing
9 changed files
with
11,060 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. | ||
|
||
### 0.0.1 (2021-11-17) | ||
|
||
## 1.0.0 (2021-11-17) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Github Action Resolve Pull Request Refs | ||
Tested only for `issue_comment` event. When your workflow triggers on a comment on PR, you can use this action. | ||
|
||
TODO: test also on `pull_request` events. | ||
|
||
## Inputs | ||
|
||
## `token` | ||
**Required:** Github API Token | ||
|
||
## Outputs | ||
|
||
## `base_ref` | ||
Pull request base ref. | ||
|
||
## `head_ref` | ||
Pull request head ref. | ||
|
||
## Example usage | ||
``` | ||
- name: resolve pr refs | ||
id: refs | ||
uses: eficode/resolve-pr-refs@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
``` | ||
|
||
## Example usecase | ||
``` | ||
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 | ||
run: | | ||
git fetch | ||
git merge --ff-only origin/${{ steps.refs.outputs.head_ref }} | ||
git push | ||
``` | ||
|
||
## 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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: 'Resolve pull request refs' | ||
author: 'Eficode' | ||
description: 'outputs base_ref and head_ref for a PR comment (issue_comment event)' | ||
inputs: | ||
token: | ||
description: Github api token. Usually GITHUB_TOKEN. | ||
required: true | ||
outputs: | ||
base_ref: | ||
description: Pull request base ref | ||
head_ref: | ||
description: Pull request head ref | ||
runs: | ||
using: 'node12' | ||
main: 'dist/index.js' |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const core = require('@actions/core'); | ||
const github = require('@actions/github'); | ||
|
||
(async () => { | ||
try { | ||
const prUrl = github.context.payload.issue.pull_request.url; | ||
|
||
const githubToken = core.getInput('token'); | ||
const octokit = github.getOctokit(githubToken); | ||
|
||
const prDetails = await octokit.request(`GET ${prUrl}`); | ||
|
||
const status = prDetails.status | ||
const headRef = prDetails.data.head.ref | ||
|
||
const baseRef = prDetails.data.base.ref | ||
|
||
core.setOutput('base_ref', baseRef); | ||
core.setOutput('head_ref', headRef); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
})(); |
Oops, something went wrong.