'How to trigger a github action when a github action push code
I have build a github action, which config as
name: clock-in
on:
workflow_dispatch:
push:
paths:
- 'src/github/log/*'
jobs:
clock-in:
runs-on: ubuntu-latest
steps:
- ...
- run: ./src/github/push.sh
and the push.sh
#! /bin/bash
remote_repo="https://${GITHUB_ACTOR}:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" # remote repo address
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "GitHub Actions"
git add .
git commit -m "update clockin log 😎"
git push
I wish that the github action can be triggered when 'src/github/log/*' file changed and pushed. however, when I make a push, it work normally, but when github action push the change, the new acion is not triggered. How I can make the action triggered when the push comes from github action
Solution 1:[1]
You could use a Javascript library for this, such as Knockout or React.
The example from Knockout's page would work great(https://knockoutjs.com/examples/helloWorld.html):
<p>First name: <input data-bind="value: firstName" /></p>
<p>Last name: <input data-bind="value: lastName" /></p>
<h2>Hello, <span data-bind="text: fullName"> </span>!</h2>
// Here's my data model
var ViewModel = function(first, last) {
this.firstName = ko.observable(first);
this.lastName = ko.observable(last);
this.fullName = ko.pureComputed(function() {
// Knockout tracks dependencies automatically. It knows that fullName depends on firstName and lastName, because these get called when evaluating fullName.
return this.firstName() + " " + this.lastName();
}, this);
};
ko.applyBindings(new ViewModel("Planet", "Earth")); // This makes Knockout get to work
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Michael |
