Skip to content

Commit f118062

Browse files
authoredDec 14, 2019
Update with working working version (actions#12)
* Fix workflow * Trigger * [auto] Update compiled version * [auto] Commit modules * Push Windows changes * Fix * [auto] Update compiled version * Try removing cwd * [auto] Update compiled version * Try with path module * [auto] Update compiled version * Fix path * [auto] Update compiled version * Use raw path * [auto] Update compiled version * Other path * [auto] Update compiled version * Avoid @action/exec * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * test * [auto] Update compiled version * Try with shelljs * [auto] Update compiled version * Fix my stupidity * Copy scripts to local dir * [auto] Update compiled version * Still use path * [auto] Update compiled version * Delete entrypoint.sh * [auto] Update compiled version * Make file executable * [auto] Update compiled version * Try using bash * [auto] Update compiled version
1 parent d81e04e commit f118062

File tree

4,276 files changed

+1075004
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,276 files changed

+1075004
-40
lines changed
 

‎.github/workflows/build-release.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929
author_name: Federico Grandi
3030
author_email: fgrandi30@gmail.com
3131
force: true
32-
message: "[auto] Commit release files"
33-
path: "."
32+
message: "[auto] Update compiled version"
33+
path: lib
3434
pattern: "*.*"
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎lib/entrypoint.sh

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
set -eu
3+
4+
# Set up .netrc file with GitHub credentials
5+
git_setup() {
6+
cat <<- EOF > $HOME/.netrc
7+
machine github.com
8+
login $GITHUB_ACTOR
9+
password $GITHUB_TOKEN
10+
11+
machine api.github.com
12+
login $GITHUB_ACTOR
13+
password $GITHUB_TOKEN
14+
EOF
15+
chmod 600 $HOME/.netrc
16+
17+
git config --global user.email "actions@github.com"
18+
git config --global user.name "Add & Commit GitHub Action"
19+
}
20+
21+
add() {
22+
if $INPUT_FORCE
23+
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
24+
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
25+
fi
26+
}
27+
28+
# This is needed to make the check work for untracked files
29+
echo "Staging files in commit path..."
30+
add
31+
32+
echo "Checking for uncommitted changes in the git working tree..."
33+
# This section only runs if there have been file changes
34+
if ! git diff --cached --exit-code
35+
then
36+
git_setup
37+
38+
git fetch
39+
40+
# Verify if the branch needs to be created
41+
if ! git rev-parse --verify --quiet "${GITHUB_REF:11}"
42+
then
43+
echo "Creating branch..."
44+
git branch "${GITHUB_REF:11}"
45+
fi
46+
47+
# Switch to branch from current workflow run
48+
echo "Switching branch..."
49+
git checkout "${GITHUB_REF:11}"
50+
51+
echo "Adding files..."
52+
add
53+
54+
echo "Creating commit..."
55+
git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
56+
57+
echo "Pushing to repo..."
58+
git push --set-upstream origin "${GITHUB_REF:11}"
59+
else
60+
echo "Working tree clean. Nothing to commit."
61+
fi

0 commit comments

Comments
 (0)
Failed to load comments.