docs(pirate16): added mock rock buttons #4128
Workflow file for this run
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
name: CI Patch | |
on: | |
push: | |
branches: | |
- 'patch*' | |
pull_request: | |
branches: | |
- 'dev' | |
types: [synchronize] | |
jobs: | |
handle: | |
runs-on: ubuntu-latest | |
if: github.repository == 'kbve/kbve' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch dev branch | |
run: git fetch origin dev | |
- name: Get Commits | |
id: get_commits | |
run: | | |
commits=$(git log --oneline origin/dev..HEAD | tr '\n' '|') | |
echo "commits=$commits" >> $GITHUB_OUTPUT | |
create_pr: | |
if: github.event_name == 'push' && github.repository == 'kbve/kbve' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# - name: Auto-Pull | |
# uses: diillson/auto-pull-request@latest | |
# with: | |
# github_token: ${{ secrets.GITHUB_TOKEN }} | |
# destination_branch: 'dev' | |
# pr_title: 'Pulling ${{ github.ref }} into Dev' | |
# pr_body: | | |
# *An automated PR* | |
# Commits: | |
# ${{ steps.get_commits.outputs.commits }} | |
# pr_label: 'auto-pr' | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Create temp directory and install @kbve/devops | |
run: | | |
mkdir -p /tmp/devops-temp | |
cd /tmp/devops-temp | |
npm install @kbve/devops --legacy-peer-deps | |
- name: Call Process and Update PR Function | |
uses: actions/github-script@v7 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_PATH: /tmp/devops-temp/node_modules | |
with: | |
script: | | |
const { _$gha_processAndUpdatePR, _$gha_createOrUpdatePR } = require('@kbve/devops'); | |
// Safely get the reference branch from github.ref or pull request context | |
let referenceBranch = null; | |
// Log the event name to understand the context | |
console.log(`GitHub Event Name: ${github.event_name}`); | |
if (github.ref) { | |
// If github.ref is available, extract branch name | |
referenceBranch = github.ref.replace('refs/heads/', ''); | |
console.log(`Using github.ref: ${referenceBranch}`); | |
} else if (context.payload && context.payload.pull_request && context.payload.pull_request.head) { | |
// If this is a pull request, get the head branch | |
referenceBranch = context.payload.pull_request.head.ref; | |
console.log(`Using context.payload.pull_request.head.ref: ${referenceBranch}`); | |
} else if (context.ref) { | |
// Fallback: If neither of the above work, try context.ref | |
referenceBranch = context.ref.replace('refs/heads/', ''); | |
console.log(`Using context.ref: ${referenceBranch}`); | |
} else { | |
// If no branch can be determined, log an error and fail | |
console.error("Unable to determine the reference branch."); | |
throw new Error("Unable to determine the reference branch."); | |
} | |
if (!referenceBranch) { | |
console.error("Reference branch is still null after checks."); | |
throw new Error("Unable to determine the reference branch."); | |
} | |
const targetBranch = 'dev'; | |
// Call function to create or update the pull request | |
await _$gha_createOrUpdatePR(github, context, referenceBranch, targetBranch); | |
// Now process and update the pull request | |
const branchToCompare = 'dev'; | |
await _$gha_processAndUpdatePR(branchToCompare, github, context); | |
update_pr: | |
if: github.event.action == 'synchronize' && github.repository == 'kbve/kbve' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Create temp directory and install @kbve/devops | |
run: | | |
mkdir -p /tmp/devops-temp | |
cd /tmp/devops-temp | |
npm install @kbve/devops --legacy-peer-deps | |
- name: Call Process and Update PR Function | |
uses: actions/github-script@v7 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_PATH: /tmp/devops-temp/node_modules | |
with: | |
script: | | |
const { _$gha_processAndUpdatePR } = require('@kbve/devops'); | |
const branchToCompare = 'dev'; | |
await _$gha_processAndUpdatePR(branchToCompare, github, context); |