Skip to content

Commit 7edf683

Browse files
committed
update action to add git commit hash to manifest rather than extra file
1 parent 1f25a6c commit 7edf683

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

.github/workflows/Update-Commit-Hash.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,23 @@ jobs:
99
permissions: write-all
1010
runs-on: ubuntu-latest
1111
steps:
12+
- uses: actions/checkout@v2
13+
- name: 'Setup jq'
14+
uses: dcarbone/install-jq-action@v2
15+
with:
16+
version: '${{ inputs.version }}'
17+
force: '${{ inputs.force }}'
18+
- id: validate_manifest
19+
run: |
20+
version=$(git log -1 --format='%H')
21+
jq --arg v "${version}" '.version = $v' manifest.json > tempManifest.json
22+
mv tempManifest.json manifest.json
1223
- uses: actions/checkout@v3
1324
- name: Update file with merge commit hash
1425
run: |
1526
git pull origin ${{ github.ref }}
16-
git log -1 --format='%H' > latestCommit.md
1727
git config --global user.email "[email protected]"
1828
git config --global user.name "ActionBot"
19-
git add latestCommit.md
29+
git add manifest.json
2030
git commit -m 'update commit hash'
2131
git push origin ${{ github.ref }}

manifest.json

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
{
2-
"snippetCategories": [
3-
{
4-
"metadata": "/snippets/functions/third-party/manifest.json"
5-
},
6-
{
7-
"metadata": "/snippets/functions/mongodb-crud/manifest.json"
8-
},
9-
{
10-
"metadata": "/snippets/functions/api-functions/manifest.json"
11-
},
12-
{
13-
"metadata": "/snippets/functions/function-context/manifest.json"
14-
},
15-
{
16-
"metadata": "/snippets/triggers/match/manifest.json"
17-
},
18-
{
19-
"metadata": "/snippets/triggers/project/manifest.json"
20-
}
21-
]
2+
"snippetCategories": [
3+
{
4+
"metadata": "/snippets/functions/third-party/manifest.json"
5+
},
6+
{
7+
"metadata": "/snippets/functions/mongodb-crud/manifest.json"
8+
},
9+
{
10+
"metadata": "/snippets/functions/api-functions/manifest.json"
11+
},
12+
{
13+
"metadata": "/snippets/functions/function-context/manifest.json"
14+
},
15+
{
16+
"metadata": "/snippets/triggers/match/manifest.json"
17+
},
18+
{
19+
"metadata": "/snippets/triggers/project/manifest.json"
20+
}
21+
],
22+
"version": "e2388f73b1f6635f983d2dcc434357c6e94eb876"
2223
}

0 commit comments

Comments
 (0)