Skip to content

Commit

Permalink
Set working directory when being called
Browse files Browse the repository at this point in the history
  • Loading branch information
Johennes committed Nov 27, 2023
1 parent 5408738 commit ef13d58
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/actions/sync-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ async function main() {

const cmd = new Command("sync-labels.ts")
.option("--delete", "Removes labels that exist in the repository but are missing from all sources", false)
.option("--dir <path>", "Working directory to run in")
.option("--labels <path...>", "Label source as GitHub repository slug or path to local YAML file. Can be specified multiple times.")
.option("--wet", "Write changes, *don't* run in dry mode", false)
.parse();
const opts = cmd.opts();
console.log(`Options: ${JSON.stringify(opts)}`);

if (opts.dir) {
process.chdir(opts.dir);
}

const merged = await readAndMergeLabels(opts.labels, accessToken);
await syncLabels(merged, repo, accessToken, opts.delete, opts.wet);
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
- name: "Sync labels"
run: |
yarn sync-labels $(echo -e "${{ inputs.LABELS }}" | xargs -r printf -- '--labels \"../%s\"\n' | xargs echo) \
${{ github.repository != 'vector-im/element-meta' && --dir .. }} \
${{ inputs.DELETE && --delete }} \
${{ inputs.WET && --wet }}
working-directory: element-meta
Expand Down

0 comments on commit ef13d58

Please sign in to comment.