Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Configuration file .github/release-drafter.yml is not found. The configuration file must reside in your default branch. #1334

Open
keithhuster opened this issue Apr 6, 2023 · 1 comment

Comments

@keithhuster
Copy link

keithhuster commented Apr 6, 2023

I am struggling to get the release-drafter action to work for a private repo within a GitHub Enterprise account. I am running this action as part of a custom GHA workflow. I am not sure where to go from here. I have also tested removing the Set GHE_HOST job step but the action fails with an Error: Validation Failed: {"resource":"Release","code":"invalid","field":"target_commitish"} error and a 422 HTTP status code when calling the https://api.github.com/repos/[MY_ORG]/[MY_REPO]/releases endpoint.

Steps I have taken so far:

  • Added a .github/release-drafter.yml file to the repository and merged the file into the main (default) branch.
name-template: 'Test - v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION-test'
categories:
  - title: '🚀 Major/Breaking Changes'
    labels:
      - '(MAJOR)'
  - title: '🐛 Minor Changes/Bug Fixes'
    labels:
      - '(MINOR)'
  - title: '🧰 Maintenance Patches'
    label: '(PATCH)'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
  ## Changes

  $CHANGES

  • Created a new test branch and added the following steps to my GHA CI workflow.
      # Create/update a GitHub Release
      # Note: Setting the `GHE_HOST` variable is required for GitHub Enterprise accounts.
      - name: Set GHE_HOST
        run: |
          echo "GITHUB_SERVER_URL = '${GITHUB_SERVER_URL}'"
          echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV

      - name: Update GitHub Release
        uses: release-drafter/release-drafter@v5
        with:
          config-name: release-drafter.yml
          name: '${{ steps.create-tag-suffix.outputs.tag_suffix }} - v${{ steps.apply-semantic-version.outputs.version }}'
          prerelease: ${{ github.event_name == 'pull_request' && true || false }}
          tag: ${{ steps.apply-semantic-version.outputs.version_tag }}
          version: 'v${{ steps.apply-semantic-version.outputs.version }}'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  • Added the following permissions to the job that runs the above steps.
    permissions:
      contents: write
      pull-requests: read
  • Created a pull request for the test branch (targeting the main branch) to trigger the CI workflow to run.

Expected Results

  • The CI workflow should run and a new GitHub Release should be created.

Actual Results

  • The CI workflow runs and the following error is reported in the GHA workflow log.
Warning: [MY_ORG]/[MY_REPO]: Invalid config file
{
  name: 'event',
  id: '463073[16](https://github.com/[MY_ORG]/[MY_REPO]/actions/runs/4630731678/jobs/8192704466#step:11:17)78',
  stack: 'Error: Configuration file .github/release-drafter.yml is not found. The configuration file must reside in your default branch.\n' +
    '    at getConfig (/runner/_work/_actions/release-drafter/release-drafter/v5/dist/index.js:1427[19](https://github.com/[MY_ORG]/[MY_REPO]/actions/runs/4630731678/jobs/8192704466#step:11:20):13)\n' +
    '    at async drafter (/runner/_work/_actions/release-drafter/release-drafter/v5/dist/index.js:142347:[20](https://github.com/[MY_ORG]/[MY_REPO]/actions/runs/4630731678/jobs/8192704466#step:11:21))\n' +
    '    at async Promise.all (index 1)',
  type: 'Error'
}
Error: Invalid config file
@keithhuster
Copy link
Author

keithhuster commented Apr 6, 2023

UPDATE: Oddly enough, I was able to get the release-drafter action to work by disabling the Set GHE_HOST step and then manually setting the commitish input arg within the Update GitHub Release step. My repo is definitely being hosted in a GHE environment so I am a bit confused as to why I had to skip this step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant