Skip to content

Commit

Permalink
Merge pull request #3 from mudlabs/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mudlabs authored Oct 22, 2020
2 parents 87d357a + 509b82d commit 7372196
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
path: README.md
strict: false
- run: |
echo "${{ steps.diff.outputs.added }}"
echo "${{ steps.diff.outputs.modified }}"
echo "${{ steps.diff.outputs.removed }}"
echo "${{ steps.diff.outputs.renamed }}"
echo "${{ steps.diff.outputs.name }}"
echo "Added? ${{ steps.diff.outputs.added }}"
echo "Modified? ${{ steps.diff.outputs.modified }}"
echo "Removed? ${{ steps.diff.outputs.removed }}"
echo "Renamed? ${{ steps.diff.outputs.renamed }}"
echo "Name: ${{ steps.diff.outputs.name }}"
18 changes: 8 additions & 10 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ const toBoolean = value => value.toLowerCase() == "true";

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

if (file) {
core.setOutput("added", file.status === "added");
core.setOutput("modified", file.status === "modified");
core.setOutput("removed", file.status === "removed");
core.setOutput("renamed", false.status === "renamed");
core.setOutput("name", file.filename);
return;
}
core.setOutput("added", file ? file.status === "added" : false);
core.setOutput("modified", file ? file.status === "modified" : false);
core.setOutput("removed", file ? file.status === "removed" : false);
core.setOutput("renamed", file ? file.status === "renamed" : false);
core.setOutput("name", file ? file.filename : target);

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

} catch (error) {
Expand Down

0 comments on commit 7372196

Please sign in to comment.