Remote Trigger Workflow #16
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: Remote Trigger Workflow | |
on: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
message: | |
description: 'Message from the remote repo' | |
required: true | |
default: 'Hello from remote' | |
data: | |
description: 'Additional data' | |
required: false | |
jobs: | |
run-remote-triggered-job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create new branch | |
run: | | |
TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
git checkout -b build-release-$TIMESTAMP | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '18.x' | |
- name: Install dependencies | |
run: | | |
corepack enable | |
yarn install --force | |
- name: Update README file | |
run: | | |
echo "1$(cat README.md)" > README.md | |
- name: Commit and push changes | |
run: | | |
git config user.name mujahid | |
git config user.email [email protected] | |
git add README.md | |
git commit -m "create build branch test" | |
git push origin HEAD | |
- name: Update README file | |
run: | | |
echo "13$(cat README.md)" > README.md | |
- name: Commit and push changes | |
run: | | |
git add README.md | |
git commit -m "create build branch test" | |
git push origin HEAD | |
- name: Run triggered action | |
run: | | |
echo "Workflow triggered remotely!" | |
echo "Message: ${{ github.event.inputs.message }}" | |
echo "Additional data: ${{ github.event.inputs.data }}" |