-
Notifications
You must be signed in to change notification settings - Fork 8
39 lines (38 loc) · 1.46 KB
/
check_new_commits.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Check for new commits
on:
schedule:
- cron: '30 12 * * *'
workflow_dispatch:
inputs: {}
jobs:
# Ensure all steps use a common revision
check:
name: Check for new commits since last release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: NationalSecurityAgency/Ghidra
- name: Check for new commits
id: check
run: |
LAST_REL_NAME=$(curl --silent "https://api.github.com/repos/${{github.repository}}/releases/latest" | jq .name)
LAST_REL_COMMITID=$(echo $LAST_REL_NAME | grep -oP "\(\K\w+(?=\))")
COMMIT_HASH_SHORT=$(git rev-parse --short HEAD)
COMMIT_HASH_LONG=$(git rev-parse HEAD)
echo "Latest commit is $COMMIT_HASH_LONG"
if [[ "$LAST_REL_NAME" == *"$COMMIT_HASH_SHORT"* ]]; then
echo "No commits since last release $LAST_REL_NAME"
else
echo "Found new commits since $LAST_REL_NAME. Triggering ci."
echo "trigger=true" >> $GITHUB_OUTPUT
echo "rev=$COMMIT_HASH_LONG" >> $GITHUB_OUTPUT
echo "lastrev=$LAST_REL_COMMITID" >> $GITHUB_OUTPUT
fi
- name: Trigger build
if: steps.check.outputs.trigger
uses: benc-uk/[email protected]
with:
workflow: "Ghidra Build"
token: ${{secrets.PAT_TOKEN}}
inputs: '{ "rev": "${{steps.check.outputs.rev}}", "prevRev": "${{steps.check.outputs.lastrev}}" }'