diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 00e430f..d083502 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -8,7 +8,7 @@ jobs: # To use this repository's private action, you must check out the repository - name: Checkout uses: actions/checkout@v2 - # Fetch all tags + # By default the checkout is shallow. Fetch all tags, branches, and history. - run: | git fetch --depth=1 origin +refs/tags/*:refs/tags/* git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* diff --git a/README.md b/README.md index 98a5c7b..1ca584b 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,25 @@ Markdown formatted changelog. ## Example usage +There are three blocks you will need. The first is an additional run block after your checkout. By default an action checkout is shallow. So add: + + - name: Checkout + uses: actions/checkout@v2 + # By default the checkout is shallow. Fetch all tags, branches, and history. + - run: | + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* + git fetch --prune --unshallow + +Next you will need to generate the changelog itself. To get the changelog between the SHA of the commit that triggered the action and the tag of the latest release: + - name: Generate changelog id: changelog uses: metcalfc/changelog-generator@v0.0.1 with: myToken: ${{ secrets.GITHUB_TOKEN }} -Or +Or if you have two specific references you want: - name: Generate changelog id: changelog @@ -36,4 +48,9 @@ Or head-ref: 'v0.0.2' base-ref: 'v0.0.1' +Lastly you need to use the changelog. + + - name: Get the changelog + run: echo "${{ steps.changelog.outputs.changelog }}" + Why do we need `myToken`? Read more here: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret