diff --git a/tasks/generate-files.yaml b/tasks/generate-files.yaml index 94265bc..a7f47ba 100644 --- a/tasks/generate-files.yaml +++ b/tasks/generate-files.yaml @@ -24,9 +24,11 @@ state: directory - name: Generate repo-ansible workflow - ansible.builtin.copy: - src: ./templates/.github/workflows/auto-run-repo-ansible.yaml + ansible.builtin.template: + src: ./templates/.github/workflows/auto-run-repo-ansible.yaml.j2 dest: "{{ repo_path }}/.github/workflows/auto-run-repo-ansible.yaml" + variable_start_string: '[[' + variable_end_string: ']]' - name: Generate dependabot automerge workflow ansible.builtin.copy: diff --git a/templates/.github/workflows/auto-run-repo-ansible.yaml b/templates/.github/workflows/auto-run-repo-ansible.yaml.j2 similarity index 86% rename from templates/.github/workflows/auto-run-repo-ansible.yaml rename to templates/.github/workflows/auto-run-repo-ansible.yaml.j2 index 14b9a6a..b714136 100644 --- a/templates/.github/workflows/auto-run-repo-ansible.yaml +++ b/templates/.github/workflows/auto-run-repo-ansible.yaml.j2 @@ -1,3 +1,4 @@ +# [[ repo_managed ]] name: Auto-run repo-ansible on: @@ -6,12 +7,13 @@ on: pull_request_target: paths: - 'repo.yaml' + - 'docs/partials/*.md' push: branches: - - main - - master + - [[ repo.github.default_branch ]] paths: - 'repo.yaml' + - 'docs/partials/*.md' permissions: contents: write # allow git commits & push @@ -61,7 +63,7 @@ jobs: - if: ${{ env.IS_PULL_REQUEST == '1' && env.REPOSITORY_CHANGED == '1' }} - name: comment with changes + name: bot comment about repo-ansible detected changes uses: actions/github-script@v7 with: script: | @@ -70,7 +72,7 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `Following repo-ansible changes will be applied when merged to main/master branch + body: `Once PR is merged, repo-ansible will run on [[ repo.github.default_branch ]] and the following changes will apply \`\`\`shell ${changes}