Skip to content

Commit

Permalink
fix(actions): add fetch-depth and git fetch (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyankatsu0105 authored Apr 29, 2020
1 parent 7b4de0b commit 994e4ff
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/shipjs/src/step/setup/CI/addGitHubActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default ({
() => {
const log = [
createGitHubAction({
content: getBaseConfig({ releaseBranch }),
content: getBaseConfig({ baseBranch, releaseBranch }),
actionPath: '.github/workflows/shipjs-trigger.yml',
dir,
dryRun,
Expand Down Expand Up @@ -53,7 +53,7 @@ export default ({
},
].filter(Boolean);

return () => log.forEach((printResult) => printResult());
return () => log.forEach(printResult => printResult());
}
);

Expand All @@ -78,7 +78,7 @@ function createGitHubAction({ content, actionPath, dir, dryRun }) {
};
}

function getBaseConfig({ releaseBranch }) {
function getBaseConfig({ baseBranch, releaseBranch }) {
return ejs.render(
`name: Ship js trigger
on:
Expand All @@ -93,6 +93,7 @@ jobs:
- uses: actions/checkout@v2
with:
ref: <%= releaseBranch %>
<%= if(baseBranch !== releaseBranch) fetch-depth: 0 %>
- uses: actions/setup-node@v1
with:
registry-url: "https://registry.npmjs.org"
Expand All @@ -102,13 +103,14 @@ jobs:
else
npm install
fi
<%= if(baseBranch !== releaseBranch) - run: git fetch %>
- run: npm run release:trigger
env:
GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: \${{ secrets.NPM_AUTH_TOKEN }}
SLACK_INCOMING_HOOK: \${{ secrets.SLACK_INCOMING_HOOK }}
`,
{ releaseBranch }
{ baseBranch, releaseBranch }
);
}

Expand Down

0 comments on commit 994e4ff

Please sign in to comment.