Skip to content

Commit a5bf169

Browse files
committed
Find correct base and head revisions
1 parent f043a4b commit a5bf169

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/main.yaml

+11-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,17 @@ jobs:
1616
contents: read
1717
packages: write
1818
id-token: write
19+
actions: read
20+
pull-requests: read
1921
steps:
20-
- uses: "actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11" # ratchet:actions/checkout@v3
22+
- uses: "actions/checkout@v4"
23+
with:
24+
fetch-depth: 0
25+
- name: Find start and end SHAs
26+
uses: nrwl/nx-set-shas@v4
27+
id: last-successful-commit-push
28+
with:
29+
main-branch-name: main
2130
- name: Determine what to do
2231
id: changed-files
2332
shell: python
@@ -29,7 +38,7 @@ jobs:
2938
from itertools import chain
3039
import subprocess
3140
32-
changed_files=set(subprocess.run(["git", "diff", "--name-only", "${{ github.event.before }}", "${{ github.event.after }}"], capture_output=True, text=True).stdout.splitlines())
41+
changed_files=set(subprocess.run(["git", "diff", "--name-only", "${{ steps.last-successful-commit-push.outputs.base }}", "${{ steps.last-successful-commit-push.outputs.head }}"], capture_output=True, text=True).stdout.splitlines())
3342
print(f"::debug::Changed files: {changed_files}")
3443
resource_files = set(chain(*(glob.glob(f) for f in os.getenv("RESOURCES", "").split(","))))
3544
print(f"::debug::Resource files: {resource_files}")

0 commit comments

Comments
 (0)