mirror of
https://github.com/stefanzweifel/git-auto-commit-action.git
synced 2024-12-06 02:09:04 +00:00
Merge pull request #45 from stefanzweifel/refactor/switch-to-js
[4.0] Switch to NodeJS Environment (BC)
This commit is contained in:
commit
cdb861eda0
16
Dockerfile
16
Dockerfile
@ -1,16 +0,0 @@
|
||||
FROM alpine/git:1.0.7
|
||||
|
||||
LABEL "com.github.actions.name"="Auto Commit changed files"
|
||||
LABEL "com.github.actions.description"="Automatically commits files which have been changed during the workflow run and push changes back to remote repository."
|
||||
LABEL "com.github.actions.icon"="git-commit"
|
||||
LABEL "com.github.actions.color"="orange"
|
||||
|
||||
LABEL "repository"="http://github.com/stefanzweifel/git-auto-commit-action"
|
||||
LABEL "homepage"="http://github.com/stefanzweifel/git-auto-commit-action"
|
||||
LABEL "maintainer"="Stefan Zweifel <hello@stefanzweifel.io>"
|
||||
|
||||
RUN apk add git-lfs
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
@ -36,8 +36,8 @@ inputs:
|
||||
default: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
|
||||
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
||||
|
||||
branding:
|
||||
icon: 'git-commit'
|
||||
|
@ -28,7 +28,7 @@ _switch_to_repository() {
|
||||
}
|
||||
|
||||
_git_is_dirty() {
|
||||
[[ -n "$(git status -s)" ]]
|
||||
[ -n "$(git status -s)" ]
|
||||
}
|
||||
|
||||
# Set up git user configuration
|
||||
|
34
index.js
Normal file
34
index.js
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Most of this code has been copied from the following GitHub Action
|
||||
* to make it simpler or not necessary to install a lot of
|
||||
* JavaScript packages to execute a shell script.
|
||||
*
|
||||
* https://github.com/ad-m/github-push-action/blob/fe38f0a751bf9149f0270cc1fe20bf9156854365/start.js
|
||||
*/
|
||||
|
||||
const spawn = require('child_process').spawn;
|
||||
const path = require("path");
|
||||
|
||||
const exec = (cmd, args=[]) => new Promise((resolve, reject) => {
|
||||
console.log(`Started: ${cmd} ${args.join(" ")}`)
|
||||
const app = spawn(cmd, args, { stdio: 'inherit' });
|
||||
app.on('close', code => {
|
||||
if(code !== 0){
|
||||
err = new Error(`Invalid status code: ${code}`);
|
||||
err.code = code;
|
||||
return reject(err);
|
||||
};
|
||||
return resolve(code);
|
||||
});
|
||||
app.on('error', reject);
|
||||
});
|
||||
|
||||
const main = async () => {
|
||||
await exec('bash', [path.join(__dirname, './entrypoint.sh')]);
|
||||
};
|
||||
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
console.error(err.stack);
|
||||
process.exit(err.code || -1);
|
||||
})
|
Loading…
Reference in New Issue
Block a user