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

Loading slack.yml config file from .github/config directory #267

Open
masoudmanson opened this issue Sep 2, 2023 · 1 comment
Open

Loading slack.yml config file from .github/config directory #267

masoudmanson opened this issue Sep 2, 2023 · 1 comment

Comments

@masoudmanson
Copy link

Describe the bug

The problem is that the action cannot load the configuration file from any directory outside of .github/workflows. Consequently, when the configuration file is placed within the 'workflows' directory, it triggers an error within GitHub actions due to a deviation from the expected workflow syntax.
No event triggers defined in "on"

To Reproduce

  1. Create a 'slack.yml' configuration file and locate it within the .github/config directory.
  2. Attempt to utilize the configuration file with the associated action.

Expected behavior

Ideally, users should have the flexibility to position the configuration file outside of the 'workflows' directory without encountering any issues.

Screenshots

In the following screenshots, you can observe the contrast between placing the configuration file in directories other than .github/workflows and adhering to the 'workflows' directory:

By putting the config file in any directory other than the .github/workflows, the action can not read config template!

      # Step 14: Post breaking changes to a Slack channel
      - name: Post breaking changes to a Slack channel
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        uses: act10ns/slack@v1
        with:
          status: complete
          channel: "#sci-design-system-breaking-changes"
          config: .github/config/slack.yml
        if: contains(toJson(github.event.commits.*.message), 'BREAKING CHANGE')
Screenshot 2023-09-01 at 9 31 33 PM

The message is constructed based on the template by putting the config file in the .github/workflows directory.

      # Step 14: Post breaking changes to a Slack channel
      - name: Post breaking changes to a Slack channel
        env:
          SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
        uses: act10ns/slack@v1
        with:
          status: complete
          channel: "#sci-design-system-breaking-changes"
          config: .github/workflows/slack.yml
        if: contains(toJson(github.event.commits.*.message), 'BREAKING CHANGE')
Screenshot 2023-09-01 at 9 32 36 PM

Desktop (please complete the following information):

  • OS: macOS Ventura 13.5.1
  • Browser: Chrome
  • Version: 116.0.5845.110 (Official Build) (arm64)

I appreciate your attention to this matter and kindly request assistance in resolving this issue to enhance the functionality and usability of the package.

@kevinheins
Copy link

@masoudmanson I just ran into this issue. You need to make sure the file exists on the runner before running the step. For example, to use a configuration file located in github/config/slack.yml, you can checkout only that file with the following:

      - uses: actions/checkout@v4
        with:
          sparse-checkout: .github/config

I believe a better user experience would be if the action failed if it could not locate the config file, but for now this should get it working for you.

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

2 participants