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

Run placeholder updates on template initialization #6

Open
morey-tech opened this issue Apr 16, 2024 · 3 comments
Open

Run placeholder updates on template initialization #6

morey-tech opened this issue Apr 16, 2024 · 3 comments

Comments

@morey-tech
Copy link
Contributor

morey-tech commented Apr 16, 2024

Replace the hack script used in the devcontainer setup with a GitHub Actions workflow.

# Disable the workflow after it has run.
name: Execute workflow only upon repository initialisation
on:
  push:
    branches:
      - '**'

jobs:
    - name: Disable this workflow
      shell: bash
      run: |
        gh workflow disable -R $GITHUB_REPOSITORY "${{ github.workflow }}"
      env:
        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Or

# The workflow runs upon branch/tag creation as well, but it gets canceled because of the conditional expression.
name: Setup repository
on:
  create

jobs:
  create_issue:
    if: github.event.ref == github.event.master_branch
    
    name: Create issue
    runs-on: ubuntu-latest
    permissions:
      issues: write
    steps:
      - uses: imjohnbo/issue-bot@v3
        with:
          title: "Test issue"

Ref: actions/toolkit#1054

@christianh814
Copy link
Member

You need "on create` as described HERE

I tried this, it doesn't work for me. Mainly because the default GITHUB_TOKEN that the workflow creates doesn't give permissions to write back to the repo (either via pull request or otherwise). And you HAVE to create a new token that allows this...which, imho, defeats the purpose of doing this in a workflow.

If you can figure it out, lmk, because I spent a day on this to no avail.

@morey-tech
Copy link
Contributor Author

@christianh814 in your testing did you assign contents: write permissions to the workflow?

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