Skip to content

Commit 7372196

Browse files
authored
Merge pull request #3 from mudlabs/dev
Dev
2 parents 87d357a + 509b82d commit 7372196

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

.github/workflows/test.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
path: README.md
1818
strict: false
1919
- run: |
20-
echo "${{ steps.diff.outputs.added }}"
21-
echo "${{ steps.diff.outputs.modified }}"
22-
echo "${{ steps.diff.outputs.removed }}"
23-
echo "${{ steps.diff.outputs.renamed }}"
24-
echo "${{ steps.diff.outputs.name }}"
20+
echo "Added? ${{ steps.diff.outputs.added }}"
21+
echo "Modified? ${{ steps.diff.outputs.modified }}"
22+
echo "Removed? ${{ steps.diff.outputs.removed }}"
23+
echo "Renamed? ${{ steps.diff.outputs.renamed }}"
24+
echo "Name: ${{ steps.diff.outputs.name }}"

action.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@ const toBoolean = value => value.toLowerCase() == "true";
2828

2929
const target = normalise(path);
3030
const files = response.data.files;
31-
const file = files.find(file => file.contents_url.indexOf(`contents/${target}`) !== -1);
31+
const file = files.find(file => decodeURIComponent(file.contents_url).indexOf(`contents/${target}`) !== -1);
3232

33-
if (file) {
34-
core.setOutput("added", file.status === "added");
35-
core.setOutput("modified", file.status === "modified");
36-
core.setOutput("removed", file.status === "removed");
37-
core.setOutput("renamed", false.status === "renamed");
38-
core.setOutput("name", file.filename);
39-
return;
40-
}
33+
core.setOutput("added", file ? file.status === "added" : false);
34+
core.setOutput("modified", file ? file.status === "modified" : false);
35+
core.setOutput("removed", file ? file.status === "removed" : false);
36+
core.setOutput("renamed", file ? file.status === "renamed" : false);
37+
core.setOutput("name", file ? file.filename : target);
4138

42-
if (strict === true) throw `None of the files in this commits diff tree match the provided file (${path}).`;
39+
if (file) return;
40+
if (strict) throw `None of the files in this commits diff tree match the provided file (${path}).`;
4341
console.log(`None of the files in this commits diff tree match the provided file (${path}).`);
4442

4543
} catch (error) {

0 commit comments

Comments
 (0)