JavaScript wrapper for octokit.pulls.create
with provided GitHub Actions Inputs
Access to GitHub Actions if using on GitHub, or manually assigning environment variables prior to running npm test
.
Reference the code of this repository within your own workflow
...
on:
push:
branches:
- src-pages
jobs:
jekyll_build:
runs-on: ubuntu-latest
steps:
- name: Checkout source branch for building Pages
uses: actions/checkout@v2
with:
ref: src-pages
fetch-depth: 10
- name: Make build destination directory
run: mkdir -vp ~/www/repository-name
- name: Jekyll Build
uses: gha-utilities/[email protected]
with:
jekyll_github_token: ${{ secrets.JEKYLL_GITHUB_TOKEN }}
source: ./
destination: ~/www/repository-name
- name: Checkout branch for Pull Requesting to GitHub Pages
uses: actions/checkout@v2
with:
ref: pr-pages
fetch-depth: 1
submodules: true
- name: Copy built site files into Git branch
run: cp -r ~/www/repository-name ./
- name: Add changes to Git tracking
run: git add -A .
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'Updates compiled site files'
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: pr-pages
- name: Initialize Pull Request
uses: gha-utilities/[email protected]
with:
verbose: true
pull_request_token: ${{ secrets.GITHUB_TOKEN }}
head: pr-pages
base: gh-pages
title: 'Updates site files from latest Actions build'
body: >
Perhaps a multi-line description
about latest features and such.
According to OctoKit documentation for octokit.pulls.create
...
You cannot submit a pull request to one repository that requests a merge to a base of another repository.
... and...
For cross-repository pull requests in the same network, namespace
head
with a user like this:username:branch
- name: Initialize Pull Request
uses: gha-utilities/[email protected]
with:
verbose: true
pull_request_token: ${{ secrets.GITHUB_TOKEN }}
head: 'your-name:pr-pages'
base: gh-pages
title: 'Updates site files from latest Actions build'
body: >
Perhaps a multi-line description
about latest features and such.
To assign a different repository modify the GITHUB_REPOSITORY
environment variable...
- name: Initialize Pull Request
uses: gha-utilities/[email protected]
env:
GITHUB_REPOSITORY: maintainer/repo-name
with:
verbose: true
pull_request_token: ${{ secrets.GITHUB_TOKEN }}
head: your-name:pr-pages
base: gh-pages
title: 'Updates site files from latest Actions build'
body: >
Perhaps a multi-line description
about latest features and such.
Inputs marked [Experimental]
within action.yaml
file (such as maintainer_can_modify
and draft
) when defined may cause issues, thus it is a good idea to also define debug: true
when testing, eg...
- name: Initialize Pull Request
uses: gha-utilities/[email protected]
env:
GITHUB_REPOSITORY: maintainer/repo-name
with:
verbose: true
debug: true
draft: false
maintainer_can_modify: true
pull_request_token: ${{ secrets.GITHUB_TOKEN }}
head: your-name:pr-pages
base: gh-pages
title: 'Updates site files from latest Actions build'
body: >
Perhaps a multi-line description
about latest features and such.
This repository may not be feature complete, or fully operational, Pull Requests are most welcomed ;-)
-
GitHub -- Creating a JavaScript Action, specifically the
commit-and-push-your-action-to-github
section that states dependencies must be checked into Git tracking. -
GitHub -- Action fails quietly due to Unhandled promise rejection
-
StackOverflow -- GitHub Actions share Workspace Artifacts between jobs
Legal bits of Open Source software. Note the following license does not necessarily apply to any dependencies of this repository, see licensing and documentation for those within there respective sub-directories under node_modules/
.
Initialize Pull Request GitHub Actions documentation
Copyright (C) 2023 S0AndS0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.