From 1d421ec3807d74bf84bcd753a0e1f6535a6738fa Mon Sep 17 00:00:00 2001 From: CollinM Date: Wed, 23 Nov 2022 10:12:28 -0600 Subject: [PATCH 1/4] adds workflow for on-deploy steps from template Signed-off-by: CollinM --- .github/workflows/template-deploy.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/template-deploy.yml diff --git a/.github/workflows/template-deploy.yml b/.github/workflows/template-deploy.yml new file mode 100644 index 0000000..98fc1a7 --- /dev/null +++ b/.github/workflows/template-deploy.yml @@ -0,0 +1,58 @@ +# This workflow contains steps which execute when template is converted to a repository + +name: template-deploy + +on: + create: + ref: main + ref_type: branch + +permissions: + contents: write + issues: write + +jobs: + # Add issue labels expected by the repository + add-repo-labels: + if: ${{ !github.event.repository.is_template }} + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + with: + script: | + let labels = [ + { + name: 'jenkins', + color: '00FFFF', + }, + { + name: 'azure-devops', + color: '00FFFF', + }, + { + name: 'circle-ci', + color: '00FFFF', + }, + { + name: 'gitlab', + color: '00FFFF', + }, + { + name: 'travis-ci', + color: '00FFFF', + }, + { + name: 'actions-importer-running', + color: '00FFFF', + } + ]; + + labels.forEach( (label) => { + github.rest.issues.createLabel({ + owner: context.repo.owner, + repo: context.repo.repo, + name: label.name, + color: label.color, + description: 'Label used by Issue Ops workflow.' + }); + }); From 461b6932b61485c4f90d3318c06288fcd6981707 Mon Sep 17 00:00:00 2001 From: CollinM Date: Wed, 23 Nov 2022 10:43:00 -0600 Subject: [PATCH 2/4] readme update for template-deploy Signed-off-by: CollinM --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 6349d1e..31de9c9 100644 --- a/Readme.md +++ b/Readme.md @@ -14,8 +14,8 @@ The GitHub Actions Importer IssueOps repository demonstrates the functionality n Complete the following steps: -1. Create a new repository using this repository as the template by clicking [here](https://github.com/actions/importer-issue-ops/generate). -2. Create the following labels in this new repository: `jenkins`, `azure-devops`, `circle-ci`, `gitlab`, `travis-ci`, and `actions-importer-running`. +1. Create a new repository using this repository as the template by clicking [here](https://github.com/actions/importer-issue-ops/generate). +2. Create the following labels in this new repository: `jenkins`, `azure-devops`, `circle-ci`, `gitlab`, `travis-ci`, and `actions-importer-running`. **Note**: This step should typically automatically complete upon repo creation from this template using the [template-deploy.yml](./github/../.github/workflows/template-deploy.yml) workflow but will need to be performed manually if this action fails or is unable to run at deploy time. 3. Add the repository secrets described below that are relevant to the CI/CD providers being migrated: ### All CI/CD providers From fbe4dc53f7d4d1ff74f4eabd500250ed557b98fa Mon Sep 17 00:00:00 2001 From: Collin McNeese Date: Wed, 23 Nov 2022 10:47:29 -0600 Subject: [PATCH 3/4] template-deploy DRY-up from initial Signed-off-by: Collin McNeese --- .github/workflows/template-deploy.yml | 34 +++++++-------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/.github/workflows/template-deploy.yml b/.github/workflows/template-deploy.yml index 98fc1a7..0375dbf 100644 --- a/.github/workflows/template-deploy.yml +++ b/.github/workflows/template-deploy.yml @@ -21,38 +21,20 @@ jobs: with: script: | let labels = [ - { - name: 'jenkins', - color: '00FFFF', - }, - { - name: 'azure-devops', - color: '00FFFF', - }, - { - name: 'circle-ci', - color: '00FFFF', - }, - { - name: 'gitlab', - color: '00FFFF', - }, - { - name: 'travis-ci', - color: '00FFFF', - }, - { - name: 'actions-importer-running', - color: '00FFFF', - } + 'jenkins', + 'azure-devops', + 'circle-ci', + 'gitlab', + 'travis-ci', + 'actions-importer-running' ]; labels.forEach( (label) => { github.rest.issues.createLabel({ owner: context.repo.owner, repo: context.repo.repo, - name: label.name, - color: label.color, + name: label, + color: '00FFFF', description: 'Label used by Issue Ops workflow.' }); }); From cbcd587bab97e70dad0232e38752ee98704fbe37 Mon Sep 17 00:00:00 2001 From: Ethan Dennis Date: Wed, 23 Nov 2022 11:58:02 -0800 Subject: [PATCH 4/4] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 31de9c9..e6cf8bf 100644 --- a/Readme.md +++ b/Readme.md @@ -15,7 +15,7 @@ The GitHub Actions Importer IssueOps repository demonstrates the functionality n Complete the following steps: 1. Create a new repository using this repository as the template by clicking [here](https://github.com/actions/importer-issue-ops/generate). -2. Create the following labels in this new repository: `jenkins`, `azure-devops`, `circle-ci`, `gitlab`, `travis-ci`, and `actions-importer-running`. **Note**: This step should typically automatically complete upon repo creation from this template using the [template-deploy.yml](./github/../.github/workflows/template-deploy.yml) workflow but will need to be performed manually if this action fails or is unable to run at deploy time. +2. Create the following labels in this new repository, if they are not already present: `jenkins`, `azure-devops`, `circle-ci`, `gitlab`, `travis-ci`, and `actions-importer-running`. 3. Add the repository secrets described below that are relevant to the CI/CD providers being migrated: ### All CI/CD providers