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

use typescript for main action file; add option to use local filepaths #36

Merged
merged 1 commit into from
Jun 1, 2023

Conversation

smzelek
Copy link
Contributor

@smzelek smzelek commented May 5, 2023

hi! I'm happy to change anything here

my team had a need to use a predownloaded, local filepath (instead of one that was hosted in the same repo).

while I was at it I changed this to use TypeScript.

I just wanted to offer up this PR as a starting point for conversation; let me know if you're super opposed to this

@thehanimo
Copy link
Owner

This is great! Typescript also seems to package the action really well. When you say local filepath, was this present in the same repo that the action's code is in? This will be useful if this repo is forked, a config is added into that fork, and any repo could then use that action (from the fork) with the pre-defined config in it, correct?

@smzelek
Copy link
Contributor Author

smzelek commented Jun 1, 2023

@thehanimo

At my company we use an action in a previous step to pull a file from a private repo shared across the organization, so that we can reuse the same config file for the PR Title Checker action across all of our team's repos. Then in the context of the Github Actions workflow, the file is now locally available and doesn't have to be fetched while this action runs.

So yes, similarly the config file could also be local to the repo running the action, and checked into a branch, fork, etc. Correct!

@smzelek
Copy link
Contributor Author

smzelek commented Jun 1, 2023

This is how our setup works, since we don't want a config file committed in every individual repo. We have a shared config in the repo that we checkout here.

But you could just checkout the same repo that is running this action instead and use a locally committed config.

name: Enforce PR Titles

on:
  workflow_call:

jobs:
  enforce-pr-title:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo with config file
        uses: actions/checkout@v3
        with:
          repository: ...
          ref: v4
          ssh-key: ${{ secrets.... }}
          path: .github/actions
      - name: Enforce PR Title
        uses: smzelek/pr-title-checker@v1.3.7
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          pass_on_octokit_error: false
          configuration_path: ".github/actions/enforce-pr-titles/config.json"
          use_local_configuration_file: true

@thehanimo
Copy link
Owner

thehanimo commented Jun 1, 2023

Thank you! I do not want to make changes to your main branch since you may be using it in your repos. I will merge this into dev and add support for external links (#28) and make a few changes.

@thehanimo thehanimo changed the base branch from main to dev June 1, 2023 20:34
@thehanimo thehanimo merged commit 481d359 into thehanimo:dev Jun 1, 2023
1 check passed
@thehanimo thehanimo mentioned this pull request Jun 2, 2023
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

Successfully merging this pull request may close these issues.

None yet

2 participants