diff --git a/README.md b/README.md index 6825eb15..3d7d70bd 100644 --- a/README.md +++ b/README.md @@ -462,6 +462,26 @@ jobs: +
+ Using git commands to detect changes + +```yaml +jobs: + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 2 # To retrieve the preceding commit. + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: .github/filters.yaml + token: '' # Use git commands +``` + +
+ ### Custom processing of changed files
diff --git a/dist/index.js b/dist/index.js index 06028273..6c8098d5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -317,7 +317,7 @@ async function getCurrentRef() { if (describe.exitCode === 0) { return describe.stdout.trim(); } - return (await exec_1.getExecOutput('git', ['rev-parse', exports.HEAD])).stdout.trim(); + return (await exec_1.getExecOutput('git', ['rev-parse', `${exports.HEAD}^2`])).stdout.trim(); } finally { core.endGroup(); @@ -1284,8 +1284,8 @@ class OidcClient { const res = yield httpclient .getJson(id_token_url) .catch(error => { - throw new Error(`Failed to get ID Token. \n - Error Code : ${error.statusCode}\n + throw new Error(`Failed to get ID Token. \n + Error Code : ${error.statusCode}\n Error Message: ${error.result.message}`); }); const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value; @@ -38003,7 +38003,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; -/******/ +/******/ /******/ // The require function /******/ function __nccwpck_require__(moduleId) { /******/ // Check if module is in cache @@ -38017,7 +38017,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ // no module.loaded needed /******/ exports: {} /******/ }; -/******/ +/******/ /******/ // Execute the module function /******/ var threw = true; /******/ try { @@ -38026,23 +38026,23 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"] /******/ } finally { /******/ if(threw) delete __webpack_module_cache__[moduleId]; /******/ } -/******/ +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } -/******/ +/******/ /************************************************************************/ /******/ /* webpack/runtime/compat */ -/******/ +/******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; -/******/ +/******/ /************************************************************************/ -/******/ +/******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __nccwpck_require__(3109); /******/ module.exports = __webpack_exports__; -/******/ +/******/ /******/ })() -; \ No newline at end of file +; diff --git a/src/git.ts b/src/git.ts index a4132362..7a36c201 100644 --- a/src/git.ts +++ b/src/git.ts @@ -176,7 +176,7 @@ export async function getCurrentRef(): Promise { return describe.stdout.trim() } - return (await getExecOutput('git', ['rev-parse', HEAD])).stdout.trim() + return (await getExecOutput('git', ['rev-parse', `${HEAD}^2`])).stdout.trim() } finally { core.endGroup() }