diff --git a/.github/ISSUE_TEMPLATE.yml b/.github/ISSUE_TEMPLATE.yml new file mode 100644 index 0000000000..4ca43840e6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.yml @@ -0,0 +1,33 @@ +name: "Test" +description: Test +title: "Test" +labels: ["test1","test2"] +assignees: + - ${{github.author}} +body: + - type: markdown + attributes: + value: | + Formulário padrão + + - type: input + id: name + attributes: + label: ">>Name<<" + description: Name + placeholder: myname + validations: + required: true + + - type: dropdown + id: template + attributes: + label: ">>Template<<" + description: Select an option + options: + - option1 + - option2 + - option3 + + validations: + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE_DEPLOYMENT.md b/.github/ISSUE_TEMPLATE_DEPLOYMENT.md new file mode 100644 index 0000000000..feedd9c119 --- /dev/null +++ b/.github/ISSUE_TEMPLATE_DEPLOYMENT.md @@ -0,0 +1,6 @@ +--- +title: Deployment Requested +labels: deployment +--- + +Version: {{ env.VERSION }} \ No newline at end of file diff --git a/.github/actions/local-action/action.yaml b/.github/actions/local-action/action.yaml new file mode 100644 index 0000000000..f66f17a3ea --- /dev/null +++ b/.github/actions/local-action/action.yaml @@ -0,0 +1,31 @@ +name: 'Local Action' +description: 'Runs a composite step action' +inputs: + name: + required: false + description: "Name" + +outputs: + random: + description: "Random number output" + value: ${{ steps.step1.outputs.random }} + +runs: + using: "composite" + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Step operations + if: ${{ inputs.name != '' }} + id: step1 + run: | + echo Hello ${{ inputs.name }} + echo List directory files + ls + echo "::set-output name=random::$(echo $RANDOM)" + shell: bash + - name: Step operations 2 + if: ${{ inputs.name == '' }} + run: | + echo Input Name is empty: ${{ inputs.name }} + shell: bash \ No newline at end of file diff --git a/.github/actions/test1/action.yaml b/.github/actions/test1/action.yaml new file mode 100644 index 0000000000..b5d7219582 --- /dev/null +++ b/.github/actions/test1/action.yaml @@ -0,0 +1,27 @@ +name: 'Demo Action' +description: 'Related to https://stackoverflow.com/questions/73193320/use-input-parameter-as-condition-to-skip-a-step' + +inputs: + dry_run: + type: boolean + description: 'Skips creation of a release' + default: false + required: true + +runs: + using: "composite" + steps: + - run: echo "Input is ${{inputs.dry_run}} " + shell: bash + + - name: 'Not false' + if: ${{ inputs.dry_run != 'false' }} + run: echo "IS NOT FALSE" + shell: bash + # uses: actions/upload-release-asset@v1 + # if: inputs.dry_run != 'false' + + - name: 'False' + if: ${{ inputs.dry_run == 'false' }} + run: echo "IS FALSE" + shell: bash \ No newline at end of file diff --git a/.github/scripts/update_file.py b/.github/scripts/update_file.py new file mode 100644 index 0000000000..34615a0507 --- /dev/null +++ b/.github/scripts/update_file.py @@ -0,0 +1,23 @@ +import os +import re + +print("START") + +WORKSPACE = os.getenv("WORKSPACE") +GITHUB_RUN_NUMBER = os.getenv("GITHUB_RUN_NUMBER") + +FILE = f"{WORKSPACE}/test.py" + +with open(FILE, "r") as file: + content = file.read() + +importlib = f'qwe = importlib.import_module("asd-{GITHUB_RUN_NUMBER}")' + +content = re.sub(r"#placeholder1", importlib, content) + +with open(FILE, "w") as file: + file.write(content) + +#print(content) + +print("END") \ No newline at end of file diff --git a/.github/workflows/01-default-workflow.yml b/.github/workflows/01-default-workflow.yml index 4feb2a6135..fcd33669c5 100644 --- a/.github/workflows/01-default-workflow.yml +++ b/.github/workflows/01-default-workflow.yml @@ -2,7 +2,7 @@ name: 01 - Default Workflow on: schedule: - - cron: "0 0 * * *" # Runs at 00:00 UTC everyday + - cron: "0 0 * * MON-FRI" # Runs at 00:00 UTC workflow_dispatch: jobs: diff --git a/.github/workflows/02-secret-workflow.yml b/.github/workflows/02-secret-workflow.yml index ae302d759e..1481ccdb76 100644 --- a/.github/workflows/02-secret-workflow.yml +++ b/.github/workflows/02-secret-workflow.yml @@ -2,7 +2,7 @@ name: 02 - Secret Workflow on: schedule: - - cron: "0 1 * * *" # Runs at 01:00 UTC everyday + - cron: "0 1 * * MON-FRI" # Runs at 01:00 UTC workflow_dispatch: jobs: @@ -23,6 +23,7 @@ jobs: owner: 'GuillaumeFalourd' repository: 'formulas-training' access-token: ${{ secrets.ACCESS_TOKEN }} + branch: master - name: Access cloned repository content run: | diff --git a/.github/workflows/03-python-script-workflow.yml b/.github/workflows/03-python-script-workflow.yml index 2f6277e920..91a9bbfab5 100644 --- a/.github/workflows/03-python-script-workflow.yml +++ b/.github/workflows/03-python-script-workflow.yml @@ -2,7 +2,7 @@ name: 03 - Python Script Workflow on: schedule: - - cron: "0 2 * * *" # Runs at 02:00 UTC everyday + - cron: "0 2 * * MON-FRI" # Runs at 02:00 UTC workflow_dispatch: jobs: diff --git a/.github/workflows/04-dispatch-event-workflow.yml b/.github/workflows/04-dispatch-event-workflow.yml index b52f792e80..0411eaa705 100644 --- a/.github/workflows/04-dispatch-event-workflow.yml +++ b/.github/workflows/04-dispatch-event-workflow.yml @@ -3,7 +3,7 @@ name: 04 - Remote Dispatch Action Initiator on: # push: schedule: - - cron: '0 3 * * *' # Runs at 3:00 UTC everyday + - cron: '0 3 * * MON-FRI' # Runs at 3:00 UTC repository_dispatch: workflow_dispatch: diff --git a/.github/workflows/05-container-workflow.yml b/.github/workflows/05-container-workflow.yml index 6bc17f5680..dab8773bf1 100644 --- a/.github/workflows/05-container-workflow.yml +++ b/.github/workflows/05-container-workflow.yml @@ -2,7 +2,7 @@ name: 05 - Container Workflow on: schedule: - - cron: "0 4 * * *" # Runs at 4:00 UTC everyday + - cron: "0 4 * * MON-FRI" # Runs at 4:00 UTC workflow_dispatch: jobs: diff --git a/.github/workflows/06-docker-image-workflow.yml b/.github/workflows/06-docker-image-workflow.yml index 2f73784d5a..14e11f131a 100644 --- a/.github/workflows/06-docker-image-workflow.yml +++ b/.github/workflows/06-docker-image-workflow.yml @@ -2,7 +2,7 @@ name: 06 - Docker Image Workflow on: schedule: - - cron: "0 5 * * *" # Runs at 5:00 UTC everyday + - cron: "0 5 * * MON-FRI" # Runs at 5:00 UTC workflow_dispatch: jobs: diff --git a/.github/workflows/08-outputs-workflow.yml b/.github/workflows/08-outputs-workflow.yml index 1b51744a38..8e78dab277 100644 --- a/.github/workflows/08-outputs-workflow.yml +++ b/.github/workflows/08-outputs-workflow.yml @@ -2,7 +2,7 @@ name: 08 - Outputs Workflow on: schedule: - - cron: "0 6 * * *" # Runs at 6:00 UTC everyday + - cron: "0 6 * * MON-FRI" # Runs at 6:00 UTC workflow_dispatch: jobs: @@ -45,17 +45,6 @@ jobs: echo '{ "ip-address": "${{ steps.xyz.outputs.ip-address }}" }' - # - name: step-4 - # id: wxyz - # uses: actions/create-release@v1 - # with: - # tag_name: 0.0.1 - # release_name: 0.0.1 - # body: "This is release 0.0.1" - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # - name: step-5 - # run: echo "${{ steps.wxyz.outputs.html_url }}" job5: runs-on: ubuntu-latest @@ -76,3 +65,19 @@ jobs: run: | echo "Number higher than 1" echo "${{ steps.xyz.outputs.acc }}" + +# job6: +# runs-on: ubuntu-latest +# steps: +# - name: step-1 +# id: wxyz +# uses: actions/create-release@v1 +# with: +# tag_name: 0.0.1 +# release_name: 0.0.1 +# body: "This is release 0.0.1" +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# - name: step-2 +# run: echo "${{ steps.wxyz.outputs.html_url }}" + diff --git a/.github/workflows/08-outputs-workflow2.yml b/.github/workflows/08-outputs-workflow2.yml new file mode 100644 index 0000000000..e224376202 --- /dev/null +++ b/.github/workflows/08-outputs-workflow2.yml @@ -0,0 +1,89 @@ +name: 08 - Outputs Workflow 2 + +on: + schedule: + - cron: "0 6 * * MON-FRI" # Runs at 6:00 UTC + workflow_dispatch: + +jobs: + + job1: + runs-on: ubuntu-latest + # Map a step output to a job output + outputs: + output1: ${{ steps.step1.outputs.test }} + output2: ${{ steps.step2.outputs.test }} + steps: + - id: step1 + run: echo "test=hello" >> $GITHUB_OUTPUT + - id: step2 + run: echo "test=world" >> $GITHUB_OUTPUT + + job2: + runs-on: ubuntu-latest + # Wait from the job1 to be completed before starting job2 + needs: job1 + steps: + - run: echo ${{needs.job1.outputs.output1}} ${{needs.job1.outputs.output2}} + + job3: + runs-on: ubuntu-latest + needs: [job1, job2] + steps: + - run: echo "Goodbye" + + job4: + runs-on: ubuntu-latest + steps: + - name: step-1 + id: xyz + run: echo "ip-address=$(curl -s ifconfig.me)" >> $GITHUB_OUTPUT + - name: step-2 + run: echo "${{ steps.xyz.outputs.ip-address }}" + - name: step-3 + run: | + echo '{ + "ip-address": "${{ steps.xyz.outputs.ip-address }}" + }' + + job5: + runs-on: ubuntu-latest + steps: + + - name: step-1 + id: xyz + run: echo "acc=$(echo $RANDOM)" >> $GITHUB_OUTPUT + + - name: step-2 + if: steps.xyz.outputs.acc < 1 + run: | + echo "Number lower than 1" + echo "${{ steps.xyz.outputs.acc }}" + + - name: step-3 + if: steps.xyz.outputs.acc > 1 + run: | + echo "Number higher than 1" + echo "${{ steps.xyz.outputs.acc }}" + + job6: + runs-on: ubuntu-latest + steps: + - name: Setup multiline output + id: test + run: | + echo "TEST=first line \ + second line \ + third line" >> $GITHUB_OUTPUT + + - name: Check multiline output + run: echo ${{steps.test.outputs.TEST}} + + - name: Setup multiline output 2 + id: test2 + run: echo "TEST=first line\n second line\n third line" >> $GITHUB_OUTPUT + + - name: Check multiline output 2 + run: | + echo ${{steps.test2.outputs.TEST}} # Will keep the n from the \n + echo -e "${{steps.test2.outputs.TEST}}" # Will break the line from the \n \ No newline at end of file diff --git a/.github/workflows/09-artifacts-workflow.yml b/.github/workflows/09-artifacts-workflow.yml index 88cbfe4a57..4d099e2958 100644 --- a/.github/workflows/09-artifacts-workflow.yml +++ b/.github/workflows/09-artifacts-workflow.yml @@ -2,12 +2,12 @@ name: 09 - Artifacts Workflow on: schedule: - - cron: "0 7 * * *" # Runs at 7:00 UTC everyday + - cron: "0 7 * * MON-FRI" # Runs at 7:00 UTC workflow_dispatch: jobs: - job_1: + sum: name: Add 3 and 7 runs-on: ubuntu-latest steps: @@ -15,18 +15,18 @@ jobs: run: | expr 3 + 7 > math-homework.txt - name: Upload math result for job 1 - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4.4.0 with: name: homework path: math-homework.txt - job_2: + multiplication: name: Multiply by 9 - needs: job_1 + needs: sum runs-on: windows-latest steps: - name: Download math result for job 1 - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.8 with: name: homework - shell: bash @@ -34,22 +34,22 @@ jobs: value=`cat math-homework.txt` expr $value \* 9 > math-homework.txt - name: Upload math result for job 2 - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4.4.0 with: name: homework path: math-homework.txt - job_3: + result: name: Display results - needs: job_2 + needs: multiplication runs-on: macOS-latest steps: - name: Download math result for job 2 - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4.1.8 with: name: homework - name: Print the final result shell: bash run: | value=`cat math-homework.txt` - echo The result is $value \ No newline at end of file + echo The result is $value diff --git a/.github/workflows/10-environment-workflow.yml b/.github/workflows/10-environment-workflow.yml index 0336ae6aa2..ffa5ed933b 100644 --- a/.github/workflows/10-environment-workflow.yml +++ b/.github/workflows/10-environment-workflow.yml @@ -2,7 +2,7 @@ name: 10 - Environment Workflow on: schedule: - - cron: "0 8 * * *" # Runs at 08:00 UTC everyday + - cron: "0 8 * * MON-FRI" # Runs at 08:00 UTC workflow_dispatch: env: @@ -62,6 +62,14 @@ jobs: run: | echo "${{ env.action_state }}" # This will output 'yellow' + job4: + runs-on: ubuntu-latest + environment: test + steps: + - name: Show repo env secret + run: | + echo ${{ secrets.REPO_ENV_SECRET }} + # Deprecated with https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ # job3: diff --git a/.github/workflows/12-run-workflow.yml b/.github/workflows/12-run-workflow.yml index 5deeaf9dfa..05e659b2e9 100644 --- a/.github/workflows/12-run-workflow.yml +++ b/.github/workflows/12-run-workflow.yml @@ -2,7 +2,7 @@ name: 12 - Run Workflow on: workflow_run: - workflows: ["Workflow Tester"] + workflows: ["12 - Workflow Tester"] types: [completed] #requested jobs: @@ -11,7 +11,7 @@ jobs: if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - run: echo "First workflow was a success" - + on-failure: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'failure' }} @@ -22,4 +22,14 @@ jobs: curl -X POST https://api.github.com/repos/GuillaumeFalourd/poc-github-actions/dispatches \ -H 'Accept: application/vnd.github.everest-preview+json' \ -u ${{ secrets.ACCESS_TOKEN }} \ - --data '{"event_type": "Start Dispatch Event Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}' \ No newline at end of file + --data '{"event_type": "Start Dispatch Event Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}' + + test: + runs-on: ubuntu-latest + steps: + - name: Show workflow_run + env: + WORKFLOW_CONTEXT: ${{ toJSON(github.event.workflow_run) }} + run: | + echo ${{ github.event.workflow_run }} + echo $WORKFLOW_CONTEXT diff --git a/.github/workflows/12-trigger-workflow-run.yml b/.github/workflows/12-trigger-workflow-run.yml new file mode 100644 index 0000000000..b8ba1d05c6 --- /dev/null +++ b/.github/workflows/12-trigger-workflow-run.yml @@ -0,0 +1,10 @@ +name: 12 - Workflow Tester + +on: + push: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "OK" \ No newline at end of file diff --git a/.github/workflows/16-conditional.yml b/.github/workflows/16-conditional.yml index 086d1d780f..89e02018ae 100644 --- a/.github/workflows/16-conditional.yml +++ b/.github/workflows/16-conditional.yml @@ -27,7 +27,7 @@ jobs: - name: Upload file status_job1.txt as an artifact if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4.4.0 with: name: pass_status_job1 path: status_job1.txt @@ -56,7 +56,7 @@ jobs: echo ${{ job.status }} > status_job2.txt - name: Upload file status_job2.txt as an artifact if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4.4.0 with: name: pass_status_job2 path: status_job2.txt @@ -73,7 +73,7 @@ jobs: echo ${{ job.status }} > status_job3.txt - name: Upload file status_job3.txt as an artifact if: always() - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v4.4.0 with: name: pass_status_job3 path: status_job3.txt @@ -84,17 +84,17 @@ jobs: if: always() steps: - name: Download artifact pass_status_job1 - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4.1.8 with: name: pass_status_job1 - name: Download artifact pass_status_job2 - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4.1.8 with: name: pass_status_job2 - name: Download artifact pass_status_job3 - uses: actions/download-artifact@v1 + uses: actions/download-artifact@v4.1.8 with: name: pass_status_job3 @@ -111,6 +111,40 @@ jobs: echo "status_job1 = ${{ steps.set_outputs.outputs.status_job1 }}" echo "status_job2 = ${{ steps.set_outputs.outputs.status_job2 }}" echo "status_job3 = ${{ steps.set_outputs.outputs.status_job3 }}" - - + check-secret: + runs-on: ubuntu-latest + outputs: + my-key: ${{ steps.my-key.outputs.defined }} + steps: + - id: my-key + env: + MY_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }} + if: "${{ env.MY_KEY != '' }}" + run: echo "defined=true" >> $GITHUB_OUTPUT + + job5: + runs-on: ubuntu-latest + needs: [check-secret] + if: needs.check-secret.outputs.my-key == 'true' + steps: + - run: echo "This command is executed if AWS_ACCESS_KEY_ID secret IS NOT empty" + + job6: + runs-on: ubuntu-latest + needs: [check-secret] + if: needs.check-secret.outputs.my-key != 'true' + steps: + - run: echo "This command is executed if AWS_ACCESS_KEY_ID secret IS empty" + + job7: + runs-on: ubuntu-latest + steps: + - id: step1 + run: echo "test=hello" >> $GITHUB_OUTPUT + - name: step 2 + if: contains(steps.step1.outputs.test, 'hello') + run: echo 'is executed' + - name: step 3 + if: contains(steps.step1.outputs.test, 'not_hello') + run: echo 'not executed' diff --git a/.github/workflows/19-push-event.yml b/.github/workflows/19-push-event.yml index 21a95ee318..3391955331 100644 --- a/.github/workflows/19-push-event.yml +++ b/.github/workflows/19-push-event.yml @@ -1,19 +1,19 @@ name: 19 - Push Event on: - push: - branches: - - '*' # for all branches - - '!main' # Except the main branch + # push: + # branches: + # - '*' # for all branches + # - '!main' # Except the main branch schedule: - - cron: "0 2 * * *" # Runs at 02:00 UTC everyday + - cron: "0 2 * * MON-FRI" # Runs at 02:00 UTC from Monday to Friday workflow_dispatch: jobs: job1: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: token: ${{ secrets.ACCESS_TOKEN }} - run: | diff --git a/.github/workflows/20-generate-patch-tag-cherry-pick.yml b/.github/workflows/20-generate-patch-tag-cherry-pick.yml index c449afce81..03b982b35a 100644 --- a/.github/workflows/20-generate-patch-tag-cherry-pick.yml +++ b/.github/workflows/20-generate-patch-tag-cherry-pick.yml @@ -17,13 +17,13 @@ jobs: generate-patch-tag: runs-on: ubuntu-latest steps: - + - name: Checkout uses: actions/checkout@v2.3.4 with: fetch-depth: 0 token: ${{ secrets.ACCESS_TOKEN }} - + - name: Execute Cherry Pick commands run: | git config user.name github-actions diff --git a/.github/workflows/21-generate-release-branch-cherry-pick.yml b/.github/workflows/21-generate-release-branch-cherry-pick.yml index a8edd5a057..66ae85e05a 100644 --- a/.github/workflows/21-generate-release-branch-cherry-pick.yml +++ b/.github/workflows/21-generate-release-branch-cherry-pick.yml @@ -17,13 +17,13 @@ jobs: generate-patch-release-branch: runs-on: ubuntu-latest steps: - + - name: Checkout uses: actions/checkout@v2.3.4 with: fetch-depth: 0 token: ${{ secrets.ACCESS_TOKEN }} - + - name: Execute Cherry Pick commands run: | git config user.name github-actions diff --git a/.github/workflows/24-contexts.yml b/.github/workflows/24-contexts.yml index 0e778416ed..7400e566e2 100644 --- a/.github/workflows/24-contexts.yml +++ b/.github/workflows/24-contexts.yml @@ -4,6 +4,7 @@ on: [workflow_dispatch, push, pull_request, issues, deployment_status] jobs: github-context: + name: job-context runs-on: ubuntu-latest steps: - name: Dump GitHub context @@ -30,3 +31,15 @@ jobs: env: MATRIX_CONTEXT: ${{ toJSON(matrix) }} run: echo "$MATRIX_CONTEXT" + +# Testing comment on https://stackoverflow.com/questions/67503656/echo-github-action-environment-variables/67504712?noredirect=1#comment134718086_67504712 + context-variables: + runs-on: ubuntu-latest + steps: + - run: | + echo "GITHUB_REPOSITORY_OWNER: $GITHUB_REPOSITORY_OWNER" + echo "GITHUB_REPOSITORY: $GITHUB_REPOSITORY" + echo "github.repository: ${{ github.repository }}" + echo "github.repository_owner: ${{ github.repository_owner }}" + echo "GITHUB.REPOSITORY: $GITHUB.REPOSITORY" + echo "GITHUB.REPOSITORY_OWNER: $GITHUB.REPOSITORY_OWNER" \ No newline at end of file diff --git a/.github/workflows/25-artifacts-between-workflows-1.yml b/.github/workflows/25-artifacts-between-workflows-1.yml index c774fcf9db..79a2336cdc 100644 --- a/.github/workflows/25-artifacts-between-workflows-1.yml +++ b/.github/workflows/25-artifacts-between-workflows-1.yml @@ -13,7 +13,7 @@ jobs: run: echo $PR_NUM > pr_num.txt - name: Upload the PR number - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4.4.0 with: name: pr_num path: ./pr_num.txt \ No newline at end of file diff --git a/.github/workflows/25-artifacts-between-workflows-2.yml b/.github/workflows/25-artifacts-between-workflows-2.yml index f3b781f7c7..3c50a937e6 100644 --- a/.github/workflows/25-artifacts-between-workflows-2.yml +++ b/.github/workflows/25-artifacts-between-workflows-2.yml @@ -2,7 +2,7 @@ name: "25 - Artifacts between workflows 2" on: workflow_run: - workflows: ['Artifacts between workflows 1'] + workflows: ['25 - Artifacts between workflows 1'] types: - completed @@ -11,16 +11,17 @@ jobs: runs-on: ubuntu-latest steps: - name: Download workflow artifact - uses: dawidd6/action-download-artifact@v2.11.0 + uses: actions/download-artifact@v4.1.8 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - workflow: peek_icons.yml - run_id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.ACCESS_TOKEN }} + name: pr_num + path: ./pr_num + run-id: ${{ github.event.workflow_run.id }} - name: Read the pr_num file id: pr_num_reader - uses: juliangruber/read-file-action@v1.0.0 + uses: juliangruber/read-file-action@v1.1.7 with: path: ./pr_num/pr_num.txt - - run: echo Original PR number is ${{ steps.pr_num_reader.outputs.content }} \ No newline at end of file + - run: echo Original PR number is ${{ steps.pr_num_reader.outputs.content }} diff --git a/.github/workflows/29-check-actor-pr-or-push.yml b/.github/workflows/29-check-actor-pr-or-push.yml new file mode 100644 index 0000000000..e50dd3e054 --- /dev/null +++ b/.github/workflows/29-check-actor-pr-or-push.yml @@ -0,0 +1,34 @@ +name: 29 - Check Actor on PR or PUSH + +on: [push, pull_request] + +jobs: + job1: + name: Check1 + runs-on: ubuntu-latest + if: ${{ github.actor != 'GuillaumeFalourd' }} + steps: + - run: echo "Actor isn't GuillaumeFalourd" + + job2: + name: Check2 + runs-on: ubuntu-latest + if: ${{ github.actor == 'GuillaumeFalourd' }} + steps: + - run: echo "Actor is GuillaumeFalourd" + + job3: + if: github.event_name == 'pull_request' && github.actor != 'GuillaumeFalourd' && github.actor != 'user1' && github.actor != 'user2' && github.actor != 'user3' + runs-on: ubuntu-latest + steps: + - name: PR Comment + uses: actions/github-script@v2 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.issues.createComment({ + issue_number: ${{ github.event.number }}, + owner: context.repo.owner, + repo: context.repo.repo, + body: ':warning: Have you followed the [contributions guidance]()? Content PRs should generally be made against the the [source repo](https://github.com//).' + }) diff --git a/.github/workflows/30-webhook-release.yml b/.github/workflows/30-webhook-release.yml new file mode 100644 index 0000000000..f161f8f7bc --- /dev/null +++ b/.github/workflows/30-webhook-release.yml @@ -0,0 +1,22 @@ +name: 30 - Webhook Release + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Echo + run: echo "Tag:" ${{ steps.get_version.outputs.VERSION }} + + - name: Trigger webhook + run: | + curl -X POST https://o2dla1l2qd.execute-api.us-east-1.amazonaws.com/prod/git \ + -H 'Accept: application/vnd.github.everest-preview+json' \ + --data '{"zipURL": "https://github.com/GuillaumeFalourd/poc-github-actions/archive/refs/tags/${{ steps.get_version.outputs.VERSION }}.zip", "name": "workflow", "version": "${{ steps.get_version.outputs.VERSION }}"}' diff --git a/.github/workflows/31-untouchable-file.yml b/.github/workflows/31-untouchable-file.yml new file mode 100644 index 0000000000..5950382294 --- /dev/null +++ b/.github/workflows/31-untouchable-file.yml @@ -0,0 +1,15 @@ +name: 31 - Untouchable file + +on: + pull_request_target: + types: [opened, reopened] + paths: + - '**/31-untouchable-file.yml' + +jobs: + test: + runs-on: "ubuntu-latest" + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: "Hi, this PR will be closed automatically. Please do not touch the '31-untouchable-file.yml' file." diff --git a/.github/workflows/32-pr-approved-and-labeled.yml b/.github/workflows/32-pr-approved-and-labeled.yml new file mode 100644 index 0000000000..9819f89634 --- /dev/null +++ b/.github/workflows/32-pr-approved-and-labeled.yml @@ -0,0 +1,51 @@ +name: 32 - PR approved and labeled + +on: + pull_request: + types: [labeled] + pull_request_review: + types: [submitted] + +jobs: + build: + runs-on: ubuntu-latest + if: ${{ (github.event.review.state == 'approved') && (contains(github.event.pull_request.labels.*.name, 'test')) }} + steps: + - run: echo "Do something" + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - run: echo ${{ github.event.review.state }} + + no-build: + runs-on: ubuntu-latest + if: ${{ (github.event.review.state != 'approved') || (!contains(github.event.pull_request.labels.*.name, 'test')) }} + steps: + - run: echo "Don't do it" + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - run: ${{ github.event.review.state }} + + test-1: + runs-on: ubuntu-latest + if: github.event.review.state == 'approved' + steps: + - run: echo "Approved!" + + test-2: + runs-on: ubuntu-latest + if: contains(github.event.pull_request.labels.*.name, 'test') + steps: + - run: echo "Contains test label!" + + test-3: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: approved or not + if: github.event.review.state == 'approved' + run: | + echo "approved" ... \ No newline at end of file diff --git a/.github/workflows/33-reusable-workflow.yml b/.github/workflows/33-reusable-workflow.yml new file mode 100644 index 0000000000..d311642ade --- /dev/null +++ b/.github/workflows/33-reusable-workflow.yml @@ -0,0 +1,39 @@ +name: 33 - Reusable workflow + +on: + workflow_call: + inputs: + username: + required: true + type: string + secrets: + token: + required: true + workflow_dispatch: + inputs: + username: + required: true + type: string + +jobs: + test: + name: Pass input and secrets to my-action + runs-on: ubuntu-latest + steps: + - name: Inputs username (workflow call) + if: ${{ inputs.username }} != '' + run: echo ${{ inputs.username }} + + - name: Inputs username (workflow dispatch) + if: ${{ github.event.inputs.username }} != '' + run: echo ${{ github.event.inputs.username }} + + - uses: actions/checkout@v2.3.4 # Necessary to access local action + + - name: Local Action Call Without Input + id: local-action + uses: ./.github/actions/local-action + with: + name: "World" + - name: Local Action Output + run: echo "${{ steps.local-action.outputs.random }}" diff --git a/.github/workflows/34-workflow-call.yml b/.github/workflows/34-workflow-call.yml new file mode 100644 index 0000000000..7883dbb927 --- /dev/null +++ b/.github/workflows/34-workflow-call.yml @@ -0,0 +1,26 @@ +name: 34 - Workflow call + +on: + workflow_dispatch: + +jobs: + call-workflow-commit-hash: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/33-reusable-workflow.yml@cbbb8b5aee55749081b51d947236e78a15e7dffe + with: + username: Guillaume + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + call-workflow-branch-ref: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/33-reusable-workflow.yml@main + with: + username: Guillaume + secrets: + token: ${{ secrets.GITHUB_TOKEN }} + + call-workflow-tag: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/33-reusable-workflow.yml@1.1.0 + with: + username: Guillaume + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/35-github-config.yml b/.github/workflows/35-github-config.yml new file mode 100644 index 0000000000..d0562f5695 --- /dev/null +++ b/.github/workflows/35-github-config.yml @@ -0,0 +1,29 @@ +name: 35 - Github Config + +on: + push: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.ACCESS_TOKEN }} + - name: Check logs + run: | + git log -n 1 --pretty=format:%an # username + git log -n 1 --pretty=format:%ae # email + git config user.name "$(git log -n 1 --pretty=format:%an)" + git config user.email "$(git log -n 1 --pretty=format:%ae)" + git config --list + # - run: | + # date > report.txt + # git config user.name "$(git log -n 1 --pretty=format:%an)" + # git config user.email "$(git log -n 1 --pretty=format:%ae)" + # git add . + # git commit -m "Update checkout workflow file" + # git push + + diff --git a/.github/workflows/36-local-action.yml b/.github/workflows/36-local-action.yml new file mode 100644 index 0000000000..bcccc69e93 --- /dev/null +++ b/.github/workflows/36-local-action.yml @@ -0,0 +1,29 @@ +name: 36 - Local Action + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 # Necessary to access local action + - name: Local Action Call + id: local-action + uses: ./.github/actions/local-action + with: + name: "World" + - name: Local Action Output + run: echo "${{ steps.local-action.outputs.random }}" + + job2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 # Necessary to access local action + - name: Local Action Call + id: local-action + uses: ./.github/workflows/local-action + with: + name: "World" + - name: Local Action Output + run: echo "${{ steps.local-action.outputs.random }}" \ No newline at end of file diff --git a/.github/workflows/37-continue-on-error-matrix.yml b/.github/workflows/37-continue-on-error-matrix.yml new file mode 100644 index 0000000000..2c1e68f18c --- /dev/null +++ b/.github/workflows/37-continue-on-error-matrix.yml @@ -0,0 +1,34 @@ +name: 37 - Continue On Error Matrix + +on: [push, workflow_dispatch] + +env: + PYTHON_VERSIONS: "2.x" + +jobs: + build: + runs-on: ubuntu-latest + strategy: + max-parallel: 2 + fail-fast: false + matrix: + python-version: [ '3.x', 'pypy-2.7', 'pypy-3.6', 'pypy-3.7' ] + name: Python ${{ matrix.python-version }} sample + continue-on-error: ${{ contains( '${{env.PYTHON_VERSION }}', '${{ matrix.python-version }}') }} + steps: + - uses: actions/checkout@v2.3.4 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + architecture: x64 + - name: Install Python dependencies + run: python -m pip install --upgrade pip requests + - name: Run script + if: ${{ contains( '3.', '${{ matrix.python-version }}') }} + id: script + continue-on-error: ${{ contains( '${{env.PYTHON_VERSION }}', '${{ matrix.python-version }}') }} + run: python run.py + - name: Last step + if: ${{ contains( '3.', '${{ matrix.python-version }}') }} + run: echo "The run script step was a ${{ steps.script.outcome }}" diff --git a/.github/workflows/38-get-pr-number-on-push-event.yml b/.github/workflows/38-get-pr-number-on-push-event.yml new file mode 100644 index 0000000000..1b507dde98 --- /dev/null +++ b/.github/workflows/38-get-pr-number-on-push-event.yml @@ -0,0 +1,24 @@ +name: 38 - Get PR Number on PUSH event + +on: [push, pull_request] + +jobs: + push: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - name: Get Pull Request Number + id: pr + run: echo "::set-output name=pull_request_number::$(gh pr view --json number -q .number || echo "")" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: echo ${{ steps.pr.outputs.pull_request_number }} + + pull-request: + runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} + steps: + - run: echo ${{ github.event.number }} \ No newline at end of file diff --git a/.github/workflows/39-extract-from-branch.yml b/.github/workflows/39-extract-from-branch.yml new file mode 100644 index 0000000000..9d77ecdba9 --- /dev/null +++ b/.github/workflows/39-extract-from-branch.yml @@ -0,0 +1,25 @@ +name: 39 - Extract from branch + +on: + push: + branches: [release-*] + +jobs: + call-release-prod: + runs-on: ubuntu-latest + steps: + - name: Extract branch tag + id: version + run: | + BRANCH=${GITHUB_REF##*/} + VERSION="${BRANCH//release-/""}" + echo $VERSION + echo ::set-output name=tag::$(echo $VERSION) + + - name: Invoke Release PROD workflow + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: 40 - Invoked Workflow Dispatch + repo: GuillaumeFalourd/poc-github-actions + token: ${{ secrets.ACCESS_TOKEN }} + inputs: '{ "tag": "${{ steps.version.outputs.tag }}" }' \ No newline at end of file diff --git a/.github/workflows/40-invoked-workflow-dispatch.yml b/.github/workflows/40-invoked-workflow-dispatch.yml new file mode 100644 index 0000000000..82280650a3 --- /dev/null +++ b/.github/workflows/40-invoked-workflow-dispatch.yml @@ -0,0 +1,17 @@ +name: '40 - Invoked Workflow Dispatch' + +on: + workflow_dispatch: + inputs: + tag: + description: 'Release version (e.g.: 0.0.0)' + required: true + +env: + RELEASE_VERSION: ${{ github.event.inputs.tag }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo ${{ env.RELEASE_VERSION }} \ No newline at end of file diff --git a/.github/workflows/41-commit-other-repo.yml b/.github/workflows/41-commit-other-repo.yml new file mode 100644 index 0000000000..3b5c0d2ceb --- /dev/null +++ b/.github/workflows/41-commit-other-repo.yml @@ -0,0 +1,23 @@ +name: 41 - Commit other repo + +on: [workflow_dispatch] + +jobs: + commit-other-repo: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + git config --global user.email "poc-github-actions-test@gmail.com" + git config --global user.name "poc-github-actions-test" + git config --global credential.helper cache + git clone https://${{secrets.ACCESS_TOKEN}}@github.com/GuillaumeFalourd/formulas-4-tests + cd formulas-4-tests + date >> poc-github-actions-test.txt + git add . + git commit -m "$(date)" + git push + + # Example to copy file from current repo + # cp index.js clonedFolder/ -f + # cd clonedFolder \ No newline at end of file diff --git a/.github/workflows/42-download-release-private-repo.yml b/.github/workflows/42-download-release-private-repo.yml new file mode 100644 index 0000000000..4e48455087 --- /dev/null +++ b/.github/workflows/42-download-release-private-repo.yml @@ -0,0 +1,29 @@ +name: 42 - Download Release Private Repo + +# Controls when the workflow will run +on: [push, workflow_dispatch] + +jobs: + get-asset: + runs-on: ubuntu-latest + steps: + - name: List Releases + run: gh release list --repo GuillaumeFalourd/formulas-training # private repo + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + + - name: Check asset + run: gh release view 2.13.3 --repo GuillaumeFalourd/formulas-training + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + + - name: Fetch latest asset + run: gh release download 2.13.3 --repo GuillaumeFalourd/formulas-training + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + + - name: See what we downloaded + run: ls + + - name: Inspect content + run: cat README.md \ No newline at end of file diff --git a/.github/workflows/43-not-trigger-on-tag.yml b/.github/workflows/43-not-trigger-on-tag.yml new file mode 100644 index 0000000000..7f86dee09a --- /dev/null +++ b/.github/workflows/43-not-trigger-on-tag.yml @@ -0,0 +1,20 @@ +name: 43 - Not trigger on tag + +on: + push: + # This should disable running the workflow on tags, according to the + # on.. GitHub Actions docs. + branches: + - "*" + pull_request: + schedule: + - cron: '48 6 * * *' + + # If you define only tags/tag-ignore or only branches/branches-ignore, the workflow won't run for events affecting the undefined Git ref. + # Reference: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "Workflow run" \ No newline at end of file diff --git a/.github/workflows/44-check-if-pr-from-fork.yml b/.github/workflows/44-check-if-pr-from-fork.yml new file mode 100644 index 0000000000..685a9f78a4 --- /dev/null +++ b/.github/workflows/44-check-if-pr-from-fork.yml @@ -0,0 +1,17 @@ +name: 44 - Check if PR from Fork + +on: [pull_request] + +jobs: + fork: + runs-on: ubuntu-latest + if: github.event.pull_request.head.repo.fork == true + steps: + - run: echo "This workflow run if PR is from a fork repo" + + not-fork: + runs-on: ubuntu-latest + if: github.event.pull_request.head.repo.fork == false + steps: + - run: echo "This workflow run if PR is NOT from a fork repo" + diff --git a/.github/workflows/45-get-all-yaml-files.yml b/.github/workflows/45-get-all-yaml-files.yml new file mode 100644 index 0000000000..9f1677be00 --- /dev/null +++ b/.github/workflows/45-get-all-yaml-files.yml @@ -0,0 +1,32 @@ +name: 45 - Get all yaml files #Related to https://stackoverflow.com/questions/71036449/how-to-scan-entire-github-repository-for-certain-files + +on: [workflow_dispatch] + +jobs: + yml: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: List yml files + run: git ls-files '*.yml' > yml-files.txt + - name: Check list + run: cat yml-files.txt + - name: Upload yml-files + uses: actions/upload-artifact@v4.4.0 + with: + name: yml-files + path: yml-files.txt + + yaml: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: List yaml files + run: git ls-files '*.yaml' > yaml-files.txt + - name: Check list + run: cat yaml-files.txt + - name: Upload yaml-files + uses: actions/upload-artifact@v4.4.0 + with: + name: yaml-files + path: yaml-files.txt diff --git a/.github/workflows/46-print-env.yml b/.github/workflows/46-print-env.yml new file mode 100644 index 0000000000..6bdc55bd8b --- /dev/null +++ b/.github/workflows/46-print-env.yml @@ -0,0 +1,23 @@ +name: 46 - Print Env + +on: + push: + +jobs: + github-actions-environment-variables-ubuntu: + runs-on: ubuntu-latest + steps: + - name: Ubuntu GitHub Actions environment variables List + run: env + + github-actions-environment-variables-windows: + runs-on: windows-latest + steps: + - name: List of the GitHub Actions environment variables on Windows + run: env + + github-actions-environment-variables-macos: + runs-on: macos-latest + steps: + - name: MacOS List of GitHub Actions environment variables + run: env diff --git a/.github/workflows/47-force-failure.yml b/.github/workflows/47-force-failure.yml new file mode 100644 index 0000000000..cc55a71497 --- /dev/null +++ b/.github/workflows/47-force-failure.yml @@ -0,0 +1,24 @@ +name: 47 - Force Failure + +on: [pull_request] + +jobs: + + print-message: + runs-on: ubuntu-latest + steps: + - run: echo ${{ github.event.commits[0].message }} + + api-tests: + if: contains(github.event.commits[0].message, '[test_api]') + runs-on: ubuntu-latest + steps: + - run: echo hello world + + not-api-tests: + if: "!contains(github.event.commits[0].message, '[test_api]')" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: Force job failure + run: exit 1 \ No newline at end of file diff --git a/.github/workflows/48-reusable-workflow-1.yml b/.github/workflows/48-reusable-workflow-1.yml new file mode 100644 index 0000000000..02c6985b0b --- /dev/null +++ b/.github/workflows/48-reusable-workflow-1.yml @@ -0,0 +1,24 @@ +name: 48 - Reusable workflow 1 + +on: + workflow_call: + +jobs: + job-reusable-1: + runs-on: ubuntu-latest + steps: + - run: | + echo "Waiting 1 minute..." + sleep 60 + echo "Hello World" + job-reusable-2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 # Necessary to access local action + - name: Local Action Call + id: local-action + uses: ./.github/actions/local-action + with: + name: "World" + - name: Local Action Output + run: echo "${{ steps.local-action.outputs.random }}" \ No newline at end of file diff --git a/.github/workflows/48-reusable-workflow-2.yml b/.github/workflows/48-reusable-workflow-2.yml new file mode 100644 index 0000000000..953be5511e --- /dev/null +++ b/.github/workflows/48-reusable-workflow-2.yml @@ -0,0 +1,13 @@ +name: 48 - Reusable workflow 2 + +on: + workflow_call: + +jobs: + job-reusable-2: + runs-on: ubuntu-latest + steps: + - run: | + echo "Waiting 1 minute 30 seconds..." + sleep 90 + echo "Hello World" \ No newline at end of file diff --git a/.github/workflows/48-reusable-workflow-3.yml b/.github/workflows/48-reusable-workflow-3.yml new file mode 100644 index 0000000000..0216a3945e --- /dev/null +++ b/.github/workflows/48-reusable-workflow-3.yml @@ -0,0 +1,13 @@ +name: 48 - Reusable workflow 3 + +on: + workflow_call: + +jobs: + job-reusable-3: + runs-on: ubuntu-latest + steps: + - run: | + echo "Waiting 2 minutes..." + sleep 120 + echo "Hello World" \ No newline at end of file diff --git a/.github/workflows/48-trigger-reusables.yml b/.github/workflows/48-trigger-reusables.yml new file mode 100644 index 0000000000..750da422c7 --- /dev/null +++ b/.github/workflows/48-trigger-reusables.yml @@ -0,0 +1,14 @@ +name: 48 - Trigger reusables + +on: + workflow_dispatch: + +jobs: + workflow-1: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/48-reusable-workflow-1.yml@main + + workflow-2: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/48-reusable-workflow-2.yml@main + + workflow-3: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/48-reusable-workflow-3.yml@main diff --git a/.github/workflows/48-wait-for-reusable-completion.yml b/.github/workflows/48-wait-for-reusable-completion.yml new file mode 100644 index 0000000000..4c1d3f9572 --- /dev/null +++ b/.github/workflows/48-wait-for-reusable-completion.yml @@ -0,0 +1,47 @@ +name: 48 - Wait for Completion + +on: + push: + +jobs: + wait-job-reusable-1: + runs-on: ubuntu-latest + steps: + - name: Wait for job-reusable-1 to succeed + uses: lewagon/wait-on-check-action@v1.0.0 + with: + ref: ${{ github.ref }} + check-name: 'workflow-1 / job-reusable-1' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + wait-job-reusable-2: + runs-on: ubuntu-latest + steps: + - name: Wait for job-reusable-1 to succeed + uses: lewagon/wait-on-check-action@v1.0.0 + with: + ref: ${{ github.ref }} + check-name: 'workflow-2 / job-reusable-2' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + wait-job-reusable-3: + runs-on: ubuntu-latest + steps: + - name: Wait for job-reusable-1 to succeed + uses: lewagon/wait-on-check-action@v1.0.0 + with: + ref: ${{ github.ref }} + check-name: 'workflow-3 / job-reusable-3' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 10 + + finish: + needs: + - wait-job-reusable-1 + - wait-job-reusable-2 + - wait-job-reusable-3 + runs-on: ubuntu-latest + steps: + - run: echo "Finish" \ No newline at end of file diff --git a/.github/workflows/49-rename-on-release.yml b/.github/workflows/49-rename-on-release.yml new file mode 100644 index 0000000000..5a95eca7d7 --- /dev/null +++ b/.github/workflows/49-rename-on-release.yml @@ -0,0 +1,14 @@ +name: 49 - Rename on Release # https://stackoverflow.com/questions/71270252/rename-a-file-based-on-release + +on: + push: + tags: + - '*' + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: env list + run: env + - run: echo $GITHUB_REF_NAME \ No newline at end of file diff --git a/.github/workflows/50-create-tag.yml b/.github/workflows/50-create-tag.yml new file mode 100644 index 0000000000..b5845859f1 --- /dev/null +++ b/.github/workflows/50-create-tag.yml @@ -0,0 +1,16 @@ +name: 50 - Create Tag + +on: + workflow_dispatch: + +jobs: + CREATE-TAG: + env: + RELEASE_VERSION: 1.1.1 + runs-on: ubuntu-latest + steps: + - name: Tag commit + uses: tvdias/github-tagger@v0.0.1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ env.RELEASE_VERSION }} \ No newline at end of file diff --git a/.github/workflows/51-concurrency.yml b/.github/workflows/51-concurrency.yml new file mode 100644 index 0000000000..9245317632 --- /dev/null +++ b/.github/workflows/51-concurrency.yml @@ -0,0 +1,20 @@ +name: 51 - Concurrency + +on: + workflow_dispatch: + # push: + # branches: [main] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + concurrency: + runs-on: ubuntu-latest + steps: + - name: Wait + run: | + echo "Start waiting..." + sleep 5m + echo "Wake up!" \ No newline at end of file diff --git a/.github/workflows/52-print-secret.yml b/.github/workflows/52-print-secret.yml new file mode 100644 index 0000000000..f5ff8a8450 --- /dev/null +++ b/.github/workflows/52-print-secret.yml @@ -0,0 +1,17 @@ +name: 52 - Print Secret + +on: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + print-secret: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Print SOME_SECRET secret value + run: echo "Secret value:" ${{ secrets.SOME_SECRET }} | sed 's/./& /g' \ No newline at end of file diff --git a/.github/workflows/53-concatenation.yml b/.github/workflows/53-concatenation.yml new file mode 100644 index 0000000000..6e00eae106 --- /dev/null +++ b/.github/workflows/53-concatenation.yml @@ -0,0 +1,30 @@ +name: 53 - Concatenation + +on: + workflow_dispatch: + +# Top level and job level environment variables cannot be concatenated. +# Previously it was possible to use set-env to achieve a similar result but this has been removed for security reasons. +# An alternative is to use environment files to achieve the same result. +# ref: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files + +env: + argument1: argument1 + argument2: argument2 + argument3: $argument1$argument2 # This won't work as expected + # Note that you can't use arg3: ${{argument1}}${{argument2}} to join these variables + +jobs: + run: + runs-on: ubuntu-latest + + steps: + - name: Concatenate values to environment file + run: | + echo "joined=${{env.argument1}}${{env.argument2}}" >> $GITHUB_ENV + - name: Check environment variable is available + run: | + echo "${{ env.joined }}" # Should return argument1argument2 + - name: Check argument 3 value + run: | + echo "${{env.argument3}}" # Will return the string $argument1$argument2 instead of the concatenated value \ No newline at end of file diff --git a/.github/workflows/54-permission.yml b/.github/workflows/54-permission.yml new file mode 100644 index 0000000000..de0ad4420e --- /dev/null +++ b/.github/workflows/54-permission.yml @@ -0,0 +1,44 @@ +name: 54 - Permission + +on: + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +jobs: + try: + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v2 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Create a Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + # The name of the tag. This should come from the webhook payload, `github.GITHUB_REF` when a user pushes a new tag + tag_name: myTag + # The name of the release. For example, `Release v1.0.1` + release_name: ReleaseName + draft: false + prerelease: false + api: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Create issue using REST API + run: | + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/issues \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --data '{ + "title": "Automated issue for commit: ${{ github.sha }}", + "body": "This issue was automatically created by the GitHub Action workflow **${{ github.workflow }}**. \n\n The commit hash was: _${{ github.sha }}_." + }' \ + --fail \ No newline at end of file diff --git a/.github/workflows/55-create-issue.yml b/.github/workflows/55-create-issue.yml new file mode 100644 index 0000000000..1482a47f96 --- /dev/null +++ b/.github/workflows/55-create-issue.yml @@ -0,0 +1,18 @@ +name: 55 - Create Issue + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Create an issue + uses: JasonEtco/create-an-issue@e6b4b190af80961b6462c725454e7828d0247a68 + with: + filename: .github/ISSUE_TEMPLATE_DEPLOYMENT.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ github.RUN_NUMBER }} \ No newline at end of file diff --git a/.github/workflows/55-read-issue.yml b/.github/workflows/55-read-issue.yml new file mode 100644 index 0000000000..7a65d9ef89 --- /dev/null +++ b/.github/workflows/55-read-issue.yml @@ -0,0 +1,17 @@ +name: 55 - Read Issue + +on: + issues: + types: [closed] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + #- name: Get Version + # run: | + # $str=(${{ github.event.issue.body }} | grep Version:) + # echo "VERSION=$str" >> $GITHUB_ENV + - name: Run a one-line script + if: contains(github.event.issue.labels.*.name, 'deployment') + run: echo Version is ${{ github.event.issue.body }} \ No newline at end of file diff --git a/.github/workflows/56-issue-form.yml b/.github/workflows/56-issue-form.yml new file mode 100644 index 0000000000..f05497bd72 --- /dev/null +++ b/.github/workflows/56-issue-form.yml @@ -0,0 +1,68 @@ +name: 56 - Issue Form + +# Example using the ISSUE FORM available on Github Enterprise (using the .github/ISSUE_TEMPLATE.yml file) + +on: + issues: + types: [opened, reopened] + +jobs: + comment: + runs-on: ubuntu-latest + if: ${{ !contains(github.event.issue.labels.*.name, 'urbancode') && !contains(github.event.issue.labels.*.name, 'stackspot') }} + steps: + - name: Create comment + uses: peter-evans/create-or-update-comment@v1 + with: + issue-number: ${{ github.event.issue.number }} + body: | + Follow the run through: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + reactions: '+1' + + form-to-json: + name: Convert Form Issue to JSON + runs-on: ubuntu-latest + needs: [comment] + outputs: + payload-parsed: ${{ steps.payload.outputs.json_var }} + steps: + - name: Run Issue form parser + id: parse + uses: peter-murray/issue-forms-body-parser@v2.0.0 + with: + issue_id: ${{ github.event.issue.number }} + separator: '###' + label_marker_start: '>>' + label_marker_end: '<<' + + - name: Set output + id: payload + run: echo ::set-output name=json_var::'${{ steps.parse.outputs.payload }}' + + - name: Show output + run: echo "${{ toJson(steps.payload.outputs.json_var) }}" + + test: + runs-on: ubuntu-latest + needs: [form-to-json] + steps: + - name: Test echo form fields + run: | + echo ${{ fromJson(needs.form-to-json.outputs.payload-parsed)['Name'] }} + echo ${{ fromJson(needs.form-to-json.outputs.payload-parsed)['Template'] }} + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + auto-closing-issue: + needs: [test] + name: Auto-closing Issue + runs-on: ubuntu-latest + steps: + - name: Close Issue + id: parse + uses: peter-evans/close-issue@v1 + with: + issue-number: ${{ github.event.issue.number }} + comment: Close automatically through https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} \ No newline at end of file diff --git a/.github/workflows/57-reusable-outputs.yml b/.github/workflows/57-reusable-outputs.yml new file mode 100644 index 0000000000..b978f11cd4 --- /dev/null +++ b/.github/workflows/57-reusable-outputs.yml @@ -0,0 +1,14 @@ +name: 57 - Reusable outputs + +on: + workflow_dispatch: + +jobs: + job1: + uses: ./.github/workflows/57-reusable-workflow.yml + + job2: + runs-on: ubuntu-latest + needs: job1 + steps: + - run: echo ${{ needs.job1.outputs.firstword }} ${{ needs.job1.outputs.secondword }} diff --git a/.github/workflows/57-reusable-workflow.yml b/.github/workflows/57-reusable-workflow.yml new file mode 100644 index 0000000000..a2798ef059 --- /dev/null +++ b/.github/workflows/57-reusable-workflow.yml @@ -0,0 +1,26 @@ +name: 57 - Reusable workflow + +on: + workflow_call: + # Map the workflow outputs to job outputs + outputs: + firstword: + description: "The first output string" + value: ${{ jobs.example_job.outputs.output1 }} + secondword: + description: "The second output string" + value: ${{ jobs.example_job.outputs.output2 }} + +jobs: + example_job: + name: Generate output + runs-on: ubuntu-latest + # Map the job outputs to step outputs + outputs: + output1: ${{ steps.step1.outputs.firstword }} + output2: ${{ steps.step2.outputs.secondword }} + steps: + - id: step1 + run: echo "firstword=hello" >> $GITHUB_OUTPUT + - id: step2 + run: echo "secondword=world" >> $GITHUB_OUTPUT diff --git a/.github/workflows/58-env-expressions.yml b/.github/workflows/58-env-expressions.yml new file mode 100644 index 0000000000..b62021296d --- /dev/null +++ b/.github/workflows/58-env-expressions.yml @@ -0,0 +1,15 @@ +name: 58 - Env Expressions + +on: + workflow_dispatch: + push: + +env: + TOKEN: "${{ github.event_name == 'push' && 'TOKEN_ON_PUSH' || 'TOKEN_NOT_ON_PUSH' }}" + + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - run: echo $TOKEN \ No newline at end of file diff --git a/.github/workflows/59-step-context.yml b/.github/workflows/59-step-context.yml new file mode 100644 index 0000000000..bff3b5780a --- /dev/null +++ b/.github/workflows/59-step-context.yml @@ -0,0 +1,23 @@ +name: 59 - Step Context + +on: + workflow_dispatch: + +jobs: + myjob: + runs-on: ubuntu-latest + steps: + - name: Step 1 + id: hello + run: echo Hello + continue-on-error: true + - name: Step 2 + id: world + run: exit 1 + continue-on-error: true + - name: Check on failures + if: steps.hello.outcome != 'success' || steps.world.outcome != 'success' + run: exit 1 + - name: Success + if: steps.hello.outcome == 'success' || steps.world.outcome == 'success' + run: echo Hello World \ No newline at end of file diff --git a/.github/workflows/60-save-secrets-variables.yml b/.github/workflows/60-save-secrets-variables.yml new file mode 100644 index 0000000000..0b551e245a --- /dev/null +++ b/.github/workflows/60-save-secrets-variables.yml @@ -0,0 +1,19 @@ +name: 60 - Save secrets variables + +on: + workflow_dispatch: + +jobs: + one: + runs-on: ubuntu-latest + steps: + - name: "Echo in file" + env: + SECRETS_VARS: ${{ toJson(secrets) }} + run: echo "$SECRETS_VARS" > "secrets.txt" + + - uses: actions/upload-artifact@v4.4.0 + name: Upload Artifact + with: + name: SecretsVariables + path: "secrets.txt" diff --git a/.github/workflows/61-create-tag-and-release.yml b/.github/workflows/61-create-tag-and-release.yml new file mode 100644 index 0000000000..3b26030b79 --- /dev/null +++ b/.github/workflows/61-create-tag-and-release.yml @@ -0,0 +1,55 @@ +name: 61 - Create release + +on: + pull_request: + types: + - closed + +#TEST + +jobs: + github-context: + name: job-context + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + tag: + if: contains(github.head_ref, 'release-') && contains(github.base_ref, 'main') && github.event.action == 'closed' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.tag }} + steps: + - name: Extract branch tag + id: tag + run: | + BRANCH=${{ github.head_ref }} + TAG="${BRANCH//release-/""}" + echo $TAG + echo "tag=$TAG" >> $GITHUB_OUTPUT + + release: + needs: + - TAG + runs-on: ubuntu-latest + env: + TAG: ${{ needs.TAG.outputs.tag }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Push tag + uses: mathieudutour/github-tag-action@v6.1 + with: + custom_tag: ${{ env.TAG }} + github_token: ${{ secrets.ACCESS_TOKEN }} + + - name: Create release + uses: softprops/action-gh-release@v1 + with: + name: ${{ env.TAG }} + tag_name: ${{ env.TAG }} + token: ${{ secrets.ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/62-trigger-on-release-other-workflow.yml b/.github/workflows/62-trigger-on-release-other-workflow.yml new file mode 100644 index 0000000000..10785799f6 --- /dev/null +++ b/.github/workflows/62-trigger-on-release-other-workflow.yml @@ -0,0 +1,21 @@ +name: 62 - Trigger on release other workflow + +on: + release: + types: + - published + +jobs: + github-context: + name: job-context + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + publish: + runs-on: ubuntu-latest + steps: + - run: echo "Publish Process" diff --git a/.github/workflows/63-matrix-folder.yml b/.github/workflows/63-matrix-folder.yml new file mode 100644 index 0000000000..74bbee412f --- /dev/null +++ b/.github/workflows/63-matrix-folder.yml @@ -0,0 +1,56 @@ +name: 63 - Matrix folder + +on: + push: + paths: + - 'folder1/**' + - 'folder2/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + folder1: ${{ steps.changes.outputs.folder1 }} + folder2: ${{ steps.changes.outputs.folder2 }} + folders: ${{ steps.array.outputs.array }} + steps: + - uses: actions/checkout@v3 + - uses: dorny/paths-filter@v2 + id: changes + with: + filters: | + folder1: + - 'folder1/**' + folder2: + - 'folder2/**' + + - name: Build Array + id: array + run: | + myArray=() + if [ "${{ steps.changes.outputs.folder1 }}" = "true" ] + then + myArray+=("folder1") + fi + if [ "${{ steps.changes.outputs.folder2 }}" = "true" ] + then + myArray+=("folder2") + fi + myArray=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${myArray[@]}") + echo "Updated folder list: $myArray" + echo "array=$myArray" >> $GITHUB_OUTPUT + shell: bash + + build: + needs: [setup] + strategy: + fail-fast: false + matrix: + folder: ${{ fromJSON(needs.setup.outputs.folders) }} + uses: ./.github/workflows/63-reusable.yml + with: + path: ${{ matrix.folder }} \ No newline at end of file diff --git a/.github/workflows/63-reusable.yml b/.github/workflows/63-reusable.yml new file mode 100644 index 0000000000..a16a97da58 --- /dev/null +++ b/.github/workflows/63-reusable.yml @@ -0,0 +1,18 @@ +name: 63 - Reusable + +on: + workflow_call: + inputs: + path: + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.path }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo ${{ inputs.path }} diff --git a/.github/workflows/64-initiator.yml b/.github/workflows/64-initiator.yml new file mode 100644 index 0000000000..a82cc52d94 --- /dev/null +++ b/.github/workflows/64-initiator.yml @@ -0,0 +1,26 @@ +name: 64 - Initiator + +on: + # workflow_dispatch: + schedule: + - cron: '0 1 * * MON-FRI' # Runs at 1:00 UTC + repository_dispatch: + +jobs: + producer: + if: github.event.action != 'Workflow Response' + runs-on: ubuntu-latest + steps: + - name: INIT REMOTE WORKFLOW + run: | + curl -X POST https://api.github.com/repos/GuillaumeFalourd/poc-remote-workflow/dispatches \ + -H 'Accept: application/vnd.github.everest-preview+json' \ + -u ${{ secrets.ACCESS_TOKEN }} \ + --data '{"event_type": "Start Workflow", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'" }}' + + receiver: + if: github.event.action == 'Workflow Response' + runs-on: ubuntu-latest + steps: + - name: RESPONSE REMOTE WORKFLOW + run: echo "RESPONSE received from '${{ github.event.client_payload.repository }}'" \ No newline at end of file diff --git a/.github/workflows/65-sequential-matrix.yml b/.github/workflows/65-sequential-matrix.yml new file mode 100644 index 0000000000..15377ea9c9 --- /dev/null +++ b/.github/workflows/65-sequential-matrix.yml @@ -0,0 +1,40 @@ +name: 65 - Sequential Matrix + +on: + workflow_dispatch: + +jobs: + orchestration: + runs-on: ubuntu-latest + outputs: + tasks: ${{ steps.tasks.outputs.tasks }} + steps: + - name: Build Tasks Array + id: tasks + run: | + myArray=() + myArray+=("task1") + myArray+=("task2") + myArray+=("task3") + myArray=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${myArray[@]}") + echo "Updated tasks list: $myArray" + echo "tasks=$myArray" >> $GITHUB_OUTPUT + shell: bash + + deploy: + runs-on: ubuntu-latest + needs: [orchestration] + strategy: + matrix: + stage: ${{ fromJSON(needs.orchestration.outputs.tasks) }} + fail-fast: true + max-parallel: 1 + # set the environment to use (environment must exist and be named the same as the stage here) + # environment: + # name: ${{ matrix.stage }} + steps: + # use environment specific secrets here for each stage + - name: Execute task ${{ matrix.stage }} + run: | + echo "Perform job executing task ${{ matrix.stage }}" + sleep 60 \ No newline at end of file diff --git a/.github/workflows/66-matrix-object.yaml b/.github/workflows/66-matrix-object.yaml new file mode 100644 index 0000000000..93e398f157 --- /dev/null +++ b/.github/workflows/66-matrix-object.yaml @@ -0,0 +1,62 @@ +name: 66 - Matrix Object + +on: + workflow_dispatch: + +jobs: + orchestration: + runs-on: ubuntu-latest + outputs: + tasks: ${{ steps.tasks.outputs.tasks }} + steps: + - name: Build Tasks Array + id: tasks + run: | + myArray=() + myArray+=("{\"name\": \"task1\", \"type\":\"IAC\"}") + myArray+=("{\"name\": \"task2\", \"type\":\"DEPLOY\"}") + myArray+=("{\"name\": \"task3\", \"type\":\"DESTROY\"}") + myArray=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${myArray[@]}") + echo "Updated tasks list: $myArray" + echo "tasks=$myArray" >> $GITHUB_OUTPUT + shell: bash + + deploy: + runs-on: ubuntu-latest + needs: [orchestration] + strategy: + matrix: + stage: ${{ fromJSON(needs.orchestration.outputs.tasks) }} + fail-fast: true + max-parallel: 1 + # set the environment to use (environment must exist and be named the same as the stage here) + # environment: + # name: ${{ matrix.stage }} + steps: + # use environment specific secrets here for each stage + - name: Execute task ${{ matrix.stage }} + id: task + run: | + echo '${{ matrix.stage }}' > task.json + NAME=$(jq '.name' task.json) + echo $NAME + echo "taskId=$NAME" >> $GITHUB_OUTPUT + rm task.json + + - if: contains( matrix.stage , 'IAC') + uses: stack-spot/runtime-github-action-iac@v2 + with: + FEATURES_LEVEL_LOG: debug + INPUT_PATH: ${{ steps.task.outputs.taskId }} + + - if: contains( matrix.stage , 'DEPLOY') + uses: stack-spot/runtime-github-action-deploy@v2 + with: + FEATURES_LEVEL_LOG: debug + INPUT_PATH: ${{ steps.task.outputs.taskId }} + + - if: contains( matrix.stage , 'DESTROY') + uses: stack-spot/runtime-github-action-destroy@v2 + with: + FEATURES_LEVEL_LOG: debug + INPUT_PATH: ${{ steps.task.outputs.taskId }} \ No newline at end of file diff --git a/.github/workflows/67-fromjson-env-var.yaml b/.github/workflows/67-fromjson-env-var.yaml new file mode 100644 index 0000000000..5220077a44 --- /dev/null +++ b/.github/workflows/67-fromjson-env-var.yaml @@ -0,0 +1,17 @@ +name: 67 - FromJSON env var + +on: + workflow_dispatch: + +env: + myjson: '{"foo1" : "bar1", "foo2": "bar2"}' + var_foo: 'foo2' + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - run: echo ${{ fromJSON(env.myjson).foo2 }} + - run: echo ${{ fromJSON(env.myjson)[env.var_foo] }} + +# REF: https://stackoverflow.com/questions/77123861/github-actions-workflow-how-to-access-fromjson-dictionary-value-using-the-key-s diff --git a/.github/workflows/68-ostypes.yml b/.github/workflows/68-ostypes.yml new file mode 100644 index 0000000000..014301b971 --- /dev/null +++ b/.github/workflows/68-ostypes.yml @@ -0,0 +1,15 @@ +name: 68 - OS TYPES + +on: + workflow_dispatch: + +jobs: + test-ostype: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + steps: + - run: | + echo $OSTYPE + shell: bash \ No newline at end of file diff --git a/.github/workflows/69-run-on-push-to-rc.yml b/.github/workflows/69-run-on-push-to-rc.yml new file mode 100644 index 0000000000..2a58c89c13 --- /dev/null +++ b/.github/workflows/69-run-on-push-to-rc.yml @@ -0,0 +1,35 @@ +name: 69 - Run on push to rc + +on: + push: + branches: + - 'rc/*.*.*' + +jobs: + release-candidate-tag: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.tag.outputs.tag }} + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + - name: Extract branch tag if necessary + id: tag + run: | + BRANCH=${{ github.ref }} + echo $BRANCH + TAG="${BRANCH//refs\/heads\/rc\//""}" + echo $TAG + echo "tag=$TAG" >> $GITHUB_OUTPUT + + release: + needs: + - release-candidate-tag + runs-on: ubuntu-latest + env: + TAG: ${{ needs.release-candidate-tag.outputs.tag }} + steps: + - name: echo TAG + run: echo ${{ env.TAG }} diff --git a/.github/workflows/70-post-failure.yml b/.github/workflows/70-post-failure.yml new file mode 100644 index 0000000000..be5ffed101 --- /dev/null +++ b/.github/workflows/70-post-failure.yml @@ -0,0 +1,19 @@ +name: 70 - Post Failure + +on: + workflow_dispatch: + +jobs: + force-failure: + runs-on: ubuntu-latest + steps: + - name: Force job failure + run: exit 1 + + post-failure: + runs-on: ubuntu-latest + needs: force-failure + if: ${{ always() && contains(needs.*.result, 'failure') }} + steps: + - name: Do something + run: echo "Do something" \ No newline at end of file diff --git a/.github/workflows/71-many-outputs-python.yml b/.github/workflows/71-many-outputs-python.yml new file mode 100644 index 0000000000..70fbfeb196 --- /dev/null +++ b/.github/workflows/71-many-outputs-python.yml @@ -0,0 +1,27 @@ +name: 71 - Many Outputs Python + +on: + workflow_dispatch: + +jobs: + python-script: + runs-on: ubuntu-latest + outputs: + test1: ${{ steps.script.outputs.TEST1 }} + test2: ${{ steps.script.outputs.TEST2 }} + test3: ${{ steps.script.outputs.TEST3 }} + steps: + - uses: actions/checkout@v4 + - name: Execute Python script + id: script + run: python output_function.py + + job2: + runs-on: ubuntu-latest + needs: python-script + steps: + - name: Print outputs + run: | + echo ${{ needs.python-script.outputs.test1 }} + echo ${{ needs.python-script.outputs.test2 }} + echo ${{ needs.python-script.outputs.test3 }} \ No newline at end of file diff --git a/.github/workflows/72-trigger-on-comment.yml b/.github/workflows/72-trigger-on-comment.yml new file mode 100644 index 0000000000..a10cb9e504 --- /dev/null +++ b/.github/workflows/72-trigger-on-comment.yml @@ -0,0 +1,17 @@ +name: 72 - Trigger on comment + +on: + issue_comment: + types: [ created ] + +permissions: + contents: read + +jobs: + build: + uses: ./.github/workflows/63-reusable.yml + if: contains(github.event.comment.body, '/retest') + secrets: inherit + with: + path: path/example + \ No newline at end of file diff --git a/.github/workflows/73-if-file-exists.yml b/.github/workflows/73-if-file-exists.yml new file mode 100644 index 0000000000..3ebdee843e --- /dev/null +++ b/.github/workflows/73-if-file-exists.yml @@ -0,0 +1,41 @@ +name: 73 - Run Step if File Exists + +on: + push: + branches: + - main + +jobs: + check_file_job: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Step to run if file exists + - name: Run if file exists + if: ${{ !cancelled() && hashFiles('test.py') != '' }} + run: | + # Your command to run if the file exists + echo "File exists, running additional steps..." + + - name: Force failure + run: exit 1 + + # Step to run if file does not exist + - name: File does not exist + if: ${{ !cancelled() && !hashFiles('does-not-exist-fail.txt') != ''}} + run: | + # Your command to run if the file does not exist + echo "File does not exist, skipping additional steps..." + echo ${{ hashFiles('does-not-exist-fail.txt') }} + echo ${{ hashFiles('does-not-exist-fail.txt') != '' }} + echo ${{ !hashFiles('does-not-exist-fail.txt') != '' }} + + # Step to run if file does not exist + - name: File does not exist (Should never run) + if: ${{ !cancelled() && hashFiles('does-not-exist-fail.txt') != ''}} + run: | + # Your command to run if the file does not exist + echo "File does not exist, skipping additional steps..." \ No newline at end of file diff --git a/.github/workflows/74-n8n-integration.yml b/.github/workflows/74-n8n-integration.yml new file mode 100644 index 0000000000..e8e14b927e --- /dev/null +++ b/.github/workflows/74-n8n-integration.yml @@ -0,0 +1,40 @@ +name: 74 - N8N Integration + +on: + workflow_dispatch: + inputs: + name: + description: "Name" + required: false + default: "John Doe" + email: + description: "Email" + required: false + default: "john.doe@example.com" + message: + description: "Message" + required: false + default: "Hello, this is a test message!" + +jobs: + n8n-integration: + runs-on: ubuntu-latest + steps: + - name: Send POST request to N8N workflow using cURL to open an issue on this repository + env: + WORKFLOW_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + echo "Workflow URL: $WORKFLOW_URL" + curl -X POST https://${{secrets.N8N_ACCOUNT}}.app.n8n.cloud/webhook/${{ secrets.N8N_PATH}} \ + -H "Content-Type: application/json" \ + -d '{ + "name": "${{ inputs.name }}", + "email": "${{ inputs.email }}", + "message": "${{ inputs.message }}", + "workflow_url": "${{ env.WORKFLOW_URL }}" + }' \ + --fail --show-error + if [ $? -ne 0 ]; then + echo "Error: cURL request failed." + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/local-action/action.yaml b/.github/workflows/local-action/action.yaml new file mode 100644 index 0000000000..f66f17a3ea --- /dev/null +++ b/.github/workflows/local-action/action.yaml @@ -0,0 +1,31 @@ +name: 'Local Action' +description: 'Runs a composite step action' +inputs: + name: + required: false + description: "Name" + +outputs: + random: + description: "Random number output" + value: ${{ steps.step1.outputs.random }} + +runs: + using: "composite" + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Step operations + if: ${{ inputs.name != '' }} + id: step1 + run: | + echo Hello ${{ inputs.name }} + echo List directory files + ls + echo "::set-output name=random::$(echo $RANDOM)" + shell: bash + - name: Step operations 2 + if: ${{ inputs.name == '' }} + run: | + echo Input Name is empty: ${{ inputs.name }} + shell: bash \ No newline at end of file diff --git a/.github/workflows/test-action/action.yaml b/.github/workflows/test-action/action.yaml new file mode 100644 index 0000000000..67c419ffb7 --- /dev/null +++ b/.github/workflows/test-action/action.yaml @@ -0,0 +1,19 @@ +name: 'Test Input' +description: 'Test input values' + +inputs: + my-input-with-default: + description: 'Input with a default' + default: 'default value' + required: false + +runs: + using: 'composite' + steps: + - name: Test Input with default + if: ${{ inputs.my-input-with-default }} + shell: bash + run: | + #!/usr/bin/env bash + set -euo pipefail + echo "my-input-with-default: '${{ inputs.my-input-with-default }}'" diff --git a/.github/workflows/workflow-tester10.yml b/.github/workflows/workflow-tester10.yml new file mode 100644 index 0000000000..e279044a74 --- /dev/null +++ b/.github/workflows/workflow-tester10.yml @@ -0,0 +1,61 @@ +name: Test 10 + +on: + workflow_dispatch: + push: + +jobs: + windows-1: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: Install Ritchie Windows Powershell + run: | + md .os + ls + echo "= = = DOWNLOAD = = = " + Invoke-WebRequest -Uri "https://v3.ritchiecli.io/3.1.0/windows/rit.exe" -OutFile rit.exe + ls + echo "= = = MOVE = = = " + move .\\rit.exe .\\.os + ls + echo "= = = OS = = = " + cd .os + ls + echo "= = = PWD = = = " + # set CurrentDir="%~dp0" + $PWD = Get-Location + echo "PWD:" $PWD + # echo "= = = SET PATH = = = " + # $PATH = [Environment]::GetEnvironmentVariable("PATH") + # [Environment]::SetEnvironmentVariable("PATH", "$PATH;$PWD") + echo "= = = ALIAS = = = " + Set-Alias -Name rit -Value $PWD\rit.exe + rit --version + shell: powershell + - name: Teste 1 + if: always() + run: | + cd .os + .\rit.exe --version + + windows-2: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2.3.4 + - name: Create binary from branch + run: | + git clone https://github.com/Microsoft/vcpkg.git + cd vcpkg + ./bootstrap-vcpkg.sh + ./vcpkg integrate install + vcpkg install curl[tool] + cd $GITHUB_WORKSPACE + curl https://commons-repo.ritchiecli.io/2.11.3/windows/rit.exe --output rit.exe + echo '{"addCommons":false, "sendMetrics":true, "runType":"local"}' | ./rit.exe init --stdin + echo "= = = ALIAS = = = " + PWD = $(pwd) + PATH=$PATH:$PWD + echo "= = = VERSION = = = " + rit --version + shell: bash diff --git a/.github/workflows/workflow-tester100-1.yml b/.github/workflows/workflow-tester100-1.yml new file mode 100644 index 0000000000..aa6f564276 --- /dev/null +++ b/.github/workflows/workflow-tester100-1.yml @@ -0,0 +1,40 @@ +name: Test 100 (1) # https://stackoverflow.com/questions/79119626/how-to-run-github-action-job-only-if-all-previous-jobs-are-successful + +on: + workflow_dispatch: + +jobs: + run-debug-tests: + name: Unit tests + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Step 1 + run: echo "This step will succeed" + - name: Step 2 + run: exit 1 # This step will fail, but the job will continue + + run-ui-tests: + name: Android Tests + runs-on: macos-latest + continue-on-error: true + steps: + - name: Step 1 + run: echo "This step will succeed" + + lint: + name: Lint check + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: Step 1 + run: echo "This step will succeed" + + build_job: + name: Building the APK + runs-on: ubuntu-latest + needs: [run-debug-tests, run-ui-tests, lint] + if: ${{ needs.run-debug-tests.result == 'success' && needs.run-ui-tests.result == 'success' && needs.lint.result == 'success' }} + steps: + - name: Step 1 + run: echo "This step will succeed" \ No newline at end of file diff --git a/.github/workflows/workflow-tester100-2.yml b/.github/workflows/workflow-tester100-2.yml new file mode 100644 index 0000000000..98498e6e72 --- /dev/null +++ b/.github/workflows/workflow-tester100-2.yml @@ -0,0 +1,37 @@ +name: Test 100 (2) # https://stackoverflow.com/questions/79119626/how-to-run-github-action-job-only-if-all-previous-jobs-are-successful + +on: + workflow_dispatch: + +jobs: + run-debug-tests: + name: Unit tests + runs-on: ubuntu-latest + steps: + - name: Step 1 + run: echo "This step will succeed" + - name: Step 2 + run: exit 1 # This step will fail, and the job won't continue + + run-ui-tests: + name: Android Tests + runs-on: macos-latest + steps: + - name: Step 1 + run: echo "This step will succeed" + + lint: + name: Lint check + runs-on: ubuntu-latest + steps: + - name: Step 1 + run: echo "This step will succeed" + + build_job: + name: Building the APK + runs-on: ubuntu-latest + needs: [run-debug-tests, run-ui-tests, lint] + if: ${{ needs.run-debug-tests.result == 'success' && needs.run-ui-tests.result == 'success' && needs.lint.result == 'success' }} + steps: + - name: Step 1 + run: echo "This step will succeed" \ No newline at end of file diff --git a/.github/workflows/workflow-tester11.yml b/.github/workflows/workflow-tester11.yml new file mode 100644 index 0000000000..d1c07ca15d --- /dev/null +++ b/.github/workflows/workflow-tester11.yml @@ -0,0 +1,16 @@ +name: Test 11 +on: + pull_request: + types: [opened, synchronize, reopened, edited] + branches: + - dev + +defaults: + run: + shell: bash + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "Test" diff --git a/.github/workflows/workflow-tester12.yml b/.github/workflows/workflow-tester12.yml new file mode 100644 index 0000000000..b588d5475a --- /dev/null +++ b/.github/workflows/workflow-tester12.yml @@ -0,0 +1,38 @@ +name: Test 12 #https://stackoverflow.com/questions/69608041/run-command-taking-output-from-previous-step-on-github-actions?noredirect=1#comment123057564_69608041 + +on: + push: + branches: [ dev ] + pull_request: + branches: [ dev ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + outputs: + hash: ${{ steps.ipfs-pin.outputs.hash }} + steps: + - uses: actions/checkout@master + - uses: jakejarvis/hugo-build-action@master + with: + args: --minify --buildDrafts + - uses: anantaramdas/ipfs-pinata-deploy-action@v1.6.4 + id: ipfs-pin + with: + pin-name: '[my-pin-name]' + path: './public' + pinata-api-key: 'API Key' + pinata-secret-api-key: 'secret API Key' + verbose: true + remove-old: true + + saves-hash-on-file: + runs-on: ubuntu-latest + needs: [build] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: '14' + - run: echo ${{steps.build.outputs.hash}} > /.github/ipfs-hash.txt diff --git a/.github/workflows/workflow-tester13.yml b/.github/workflows/workflow-tester13.yml new file mode 100644 index 0000000000..2e412db463 --- /dev/null +++ b/.github/workflows/workflow-tester13.yml @@ -0,0 +1,19 @@ +name: Test 13 + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '2.7' + architecture: 'x64' + - uses: GuillaumeFalourd/ritchie-cli-action@v1 + with: + rit_formula_command: rit test office365 + rit_repo_url: https://github.com/GuillaumeFalourd/formulas-perso + access_token: ${{ secrets.ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester14.yml b/.github/workflows/workflow-tester14.yml new file mode 100644 index 0000000000..c390fd0074 --- /dev/null +++ b/.github/workflows/workflow-tester14.yml @@ -0,0 +1,11 @@ +name: Test 14 #https://stackoverflow.com/questions/70101203/github-actions-workflow-syntax-not-working-as-expected?noredirect=1#70101203 +on: + push: + paths: + - '**\/abc**' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "Test" diff --git a/.github/workflows/workflow-tester15.yml b/.github/workflows/workflow-tester15.yml new file mode 100644 index 0000000000..382a37ec08 --- /dev/null +++ b/.github/workflows/workflow-tester15.yml @@ -0,0 +1,12 @@ +name: Test 15 #https://stackoverflow.com/questions/70290183/github-actions-pull-request-when-base-branch-has-name-something-not-target + +on: + pull_request: + branches: + - 'something\/**' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: echo "Test" \ No newline at end of file diff --git a/.github/workflows/workflow-tester16.yml b/.github/workflows/workflow-tester16.yml new file mode 100644 index 0000000000..a69fb0eb7c --- /dev/null +++ b/.github/workflows/workflow-tester16.yml @@ -0,0 +1,70 @@ +name: Test 16 #https://stackoverflow.com/questions/60364190/invalid-workflow-file + +on: + workflow_dispatch: + pull_request: + branches: + - main + +env: + IMAGE_NAME: api + +jobs: + build: + name: Application build + runs-on: ubuntu-latest + steps: + - name: Checkout repository (#1) + uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.101 + - name: Build API + run: dotnet build --configuration Release + + tests: + runs-on: ubuntu-latest + steps: + - name: Checkout repository (#2) + uses: actions/checkout@v2 + - name: Setup .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.101 + - name: Run API Tests + run: dotnet test + + auto-approve: + name: Auto approve pull request + runs-on: ubuntu-latest + steps: + - uses: hmarr/auto-approve-action@v2.0.0 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + automerge: + runs-on: ubuntu-latest + steps: + - name: automerge + uses: "pascalgn/automerge-action@ccae530ae13b6af67a7a2009c266fe925844e658" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + + docker-build: + runs-on: ubuntu-latest + steps: + - name: Build the Docker image + run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) + + docker-deploy: + runs-on: ubuntu-latest + steps: + - name: Push Docker image to registry + uses: jerray/publish-docker-action@master + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + registry: docker.pkg.github.com + repository: jerray/publish-docker-action + auto_tag: true diff --git a/.github/workflows/workflow-tester17.yml b/.github/workflows/workflow-tester17.yml new file mode 100644 index 0000000000..62729927db --- /dev/null +++ b/.github/workflows/workflow-tester17.yml @@ -0,0 +1,35 @@ +name: Test 17 #https://stackoverflow.com/questions/60316124/is-it-possible-to-create-a-if-statement-when-setting-an-action-input-on-github-a + +on: + workflow_dispatch: + +env: + IMAGE_NAME: api + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check environment + id: check + run: | + if [ ${{ github.ref }} != 'refs/heads/main' ]; then + echo "IS NOT main branch" + echo "environment a" + echo "::set-output name=environment::a" + else + echo "IS main branch" + echo "environment b" + echo "::set-output name=environment::b" + fi + shell: bash + # - name: My action + # uses: myAction@v1 + # with: + # config 1: some config identical to other step + # config 2: some other config identical to other step + # environment: ${{ steps.check.outputs.environment }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Test + run: echo "${{ steps.check.outputs.environment }}" diff --git a/.github/workflows/workflow-tester18.yml b/.github/workflows/workflow-tester18.yml new file mode 100644 index 0000000000..1704dbb0f1 --- /dev/null +++ b/.github/workflows/workflow-tester18.yml @@ -0,0 +1,40 @@ +name: Test 18 #https://stackoverflow.com/questions/70326569/github-workflow-how-to-conditionally-setup-env-for-all-subsequent-jobs + +on: + workflow_dispatch: + push: + +jobs: + setup-job: + runs-on: ubuntu-latest + outputs: + var1: ${{ steps.set-variable.outputs.test }} + steps: + - uses: actions/checkout@v2 + - name: Set test variable + id: set-variable + run: | + if [ ${{ github.ref }} != 'refs/heads/main' ]; then + echo "IS NOT main branch" + echo "test=abc" >> $GITHUB_ENV + echo "::set-output name=test::abc" + else + echo "IS main branch" + echo "test=123" >> $GITHUB_ENV + echo "::set-output name=test::123" + fi + shell: bash + - name: Read exported variable + run: | + echo "ENV: ${{ env.test }}" + echo "OUTPUT: ${{ steps.check.test-env.test }}" + + subsequent-job: + runs-on: ubuntu-latest + needs: [setup-job] + steps: + - uses: actions/checkout@v2 + - name: Read exported variable + run: | + echo "ENV: ${{ env.test }}" + echo "OUTPUT: ${{needs.setup-job.outputs.var1}}" \ No newline at end of file diff --git a/.github/workflows/workflow-tester19.yml b/.github/workflows/workflow-tester19.yml new file mode 100644 index 0000000000..c076fcb818 --- /dev/null +++ b/.github/workflows/workflow-tester19.yml @@ -0,0 +1,20 @@ +name: Test 19 #https://stackoverflow.com/questions/65893608/github-actions-unable-to-set-up-python-virtual-environment + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Run Python commands + run: | + pip install --upgrade pip + python3.8 -m venv env + source env/bin/activate + echo "VIRTUAL ENV:" $VIRTUAL_ENV \ No newline at end of file diff --git a/.github/workflows/workflow-tester20.yml b/.github/workflows/workflow-tester20.yml new file mode 100644 index 0000000000..d3d795f4e7 --- /dev/null +++ b/.github/workflows/workflow-tester20.yml @@ -0,0 +1,256 @@ + name: 'Test 20' # Related to https://stackoverflow.com/questions/70531237/github-actions-yaml-for-multiple-deployment-images-for-different-stages-with-the?noredirect=1#comment124678457_70531237 + + on: + # push: + # branches-ignore: + # - '**' + + workflow_dispatch: + inputs: + git-ref: + description: Git Ref (Optional) + default: develop + required: false + + account: + description: slb-dev, slb-prod + default: slb-dev + required: true + + account_prod: + description: slb-dev, slb-prod + default: slb-prod + required: true + + environment: + description: development (main, int, qs), production (v1_demo, v1_rosecity, demo) + default: main + required: false + + microservice: + description: chroma, liquid, tenant, dashboard, lims, lims-simulator, client, logging, metrc + default: chroma + required: false + + builddir: + description: MicroChromatographyService/MicroChromatographyService, MicroLiquidHandlingService/MicroLiquidHandlingService, MicroTenantService/MicroTenantService, MicroDashboardService/MicroDashboardService, LIMSIntegrationService/LIMSIntegrationService, LIMSSimulatorService/LIMSSimulatorService, IntegrationHubClientService/IntegrationHubClientService, PerkinElmer.LoggingService/PerkinElmer.LoggingService, MetRCReportService/MetRCReportService + default: MicroChromatographyService/MicroChromatographyService + required: false + + jobs: + setup1: + name: Setup ENV Variables + runs-on: ubuntu-latest + environment: + name: dev + url: https://dev.test.com + outputs: + APP_NAME: ${{ steps.setprodvars.outputs.APP_NAME }} + AWS_REGION: ${{ steps.setprodvars.outputs.AWS_REGION }} + SHA8: ${{ steps.setprodvars.outputs.SHA8 }} + BUILD_DIR: ${{ steps.setprodvars.outputs.BUILD_DIR }} + ECR_REPOSITORY: ${{ steps.setprodvars.outputs.ECR_REPOSITORY }} + ECS_CLUSTER: ${{ steps.setprodvars.outputs.ECS_CLUSTER }} + ECS_SERVICE: ${{ steps.setprodvars.outputs.ECS_SERVICE }} + ECS_TASK_DEFINITION: ${{ steps.setprodvars.outputs.ECS_TASK_DEFINITION }} + ECS_TASK_DEFINITION_FILE: ${{ steps.setprodvars.outputs.ECS_TASK_DEFINITION_FILE }} + ECS_CONTAINER_NAME: ${{ steps.setprodvars.outputs.ECS_CONTAINER_NAME }} + steps: + - name: Set Prod Vars + id: setprodvars + run: | + echo "::set-output name=APP_NAME::${{ github.event.inputs.microservice }}" + echo "::set-output name=AWS_REGION::us-east-1" + echo "::set-output name=SHA8::${{ github.sha }} | cut -c1-8)" + echo "::set-output name=BUILD_DIR::${{ github.event.inputs.builddir }}" + echo "::set-output name=ECR_REPOSITORY::${{ github.event.inputs.account_prod }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + echo "::set-output name=ECS_CLUSTER::${{ github.event.inputs.account_prod }}-${{ github.event.inputs.environment }}" + echo "::set-output name=ECS_SERVICE::${{ github.event.inputs.account_prod }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + echo "::set-output name=ECS_TASK_DEFINITION::${{ github.event.inputs.account_prod }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + echo "::set-output name=ECS_TASK_DEFINITION_FILE::task-definition-${{ github.event.inputs.microservice }}.json" + echo "::set-output name=ECS_CONTAINER_NAME::${{ github.event.inputs.account_prod }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + + setup2: + name: Setup PROD Variables + runs-on: ubuntu-latest + environment: + name: Production + url: 'http://dev.myapp.com' + outputs: + APP_NAME: ${{ steps.setvars.outputs.APP_NAME }} + AWS_REGION: ${{ steps.setvars.outputs.AWS_REGION }} + SHA8: ${{ steps.setvars.outputs.SHA8 }} + BUILD_DIR: ${{ steps.setvars.outputs.BUILD_DIR }} + ECR_REPOSITORY: ${{ steps.setvars.outputs.ECR_REPOSITORY }} + ECS_CLUSTER: ${{ steps.setvars.outputs.ECS_CLUSTER }} + ECS_SERVICE: ${{ steps.setvars.outputs.ECS_SERVICE }} + ECS_TASK_DEFINITION: ${{ steps.setvars.outputs.ECS_TASK_DEFINITION }} + ECS_TASK_DEFINITION_FILE: ${{ steps.setvars.outputs.ECS_TASK_DEFINITION_FILE }} + ECS_CONTAINER_NAME: ${{ steps.setvars.outputs.ECS_CONTAINER_NAME }} + steps: + - name: Set Vars + id: setvars + run: | + echo "::set-output name=APP_NAME::${{ github.event.inputs.microservice }}" + echo "::set-output name=AWS_REGION::us-east-1" + echo "::set-output name=SHA8::${{ github.sha }} | cut -c1-8)" + echo "::set-output name=BUILD_DIR::${{ github.event.inputs.builddir }}" + echo "::set-output name=ECR_REPOSITORY::${{ github.event.inputs.account }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + echo "::set-output name=ECS_CLUSTER::${{ github.event.inputs.account }}-${{ github.event.inputs.environment }}" + echo "::set-output name=ECS_SERVICE::${{ github.event.inputs.account }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + echo "::set-output name=ECS_TASK_DEFINITION::${{ github.event.inputs.account }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + echo "::set-output name=ECS_TASK_DEFINITION_FILE::task-definition-${{ github.event.inputs.microservice }}.json" + echo "::set-output name=ECS_CONTAINER_NAME::${{ github.event.inputs.account }}-${{ github.event.inputs.environment }}-${{ github.event.inputs.microservice }}" + + DeployDev: + name: Deploy to Dev + needs: setup1 + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + id-token: write + environment: + name: Dev + url: 'http://dev.myapp.com' + steps: + - name: Set Environments + run: | + if [[ "${{github.event.inputs.account}}" == "slb-dev" ]]; then + echo "AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV + echo "AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV + fi + + if [[ "${{github.event.inputs.account}}" == "slb-prod" ]]; then + echo "AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV + echo "AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV + fi + + - name: Clone Repository (Current branch) + uses: actions/checkout@v2 + if: github.event.inputs.git-ref == '' + + - name: Clone Repository (Custom Ref) + uses: actions/checkout@v2 + if: github.event.inputs.git-ref != '' + with: + ref: ${{ github.event.inputs.git-ref }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ needs.setup1.outputs.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ needs.setup1.outputs.ECR_REPOSITORY }} + IMAGE_TAG: ${{ github.sha }} + run: | + cd ${{ needs.setup1.outputs.BUILD_DIR }} + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" + + - name: Download task definition + run: | + aws ecs describe-task-definition --task-definition ${{ needs.setup1.outputs.ECS_TASK_DEFINITION }} --query taskDefinition > ${{ needs.setup1.outputs.ECS_TASK_DEFINITION_FILE }} + + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@v1 + with: + task-definition: ${{ needs.setup1.outputs.ECS_TASK_DEFINITION_FILE }} + container-name: ${{ needs.setup1.outputs.ECS_CONTAINER_NAME }} + image: ${{ steps.build-image.outputs.image }} + + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: ${{ needs.setup1.outputs.ECS_SERVICE }} + cluster: ${{ needs.setup1.outputs.ECS_CLUSTER }} + wait-for-service-stability: true + + + DeployProd: + name: Deploy to Production + needs: [setup2, DeployDev] + runs-on: ubuntu-latest + permissions: + packages: write + contents: write + id-token: write + environment: + name: Production + url: 'http://dev.myapp.com' + steps: + - name: Set Environments + run: | + if [[ "${{github.event.inputs.account_prod}}" == "slb-dev" ]]; then + echo "AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV + echo "AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV + fi + if [[ "${{github.event.inputs.account_prod}}" == "slb-prod" ]]; then + echo "AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }}" >> $GITHUB_ENV + echo "AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV + fi + - name: Clone Repository (Current branch) + uses: actions/checkout@v2 + if: github.event.inputs.git-ref == '' + + - name: Clone Repository (Custom Ref) + uses: actions/checkout@v2 + if: github.event.inputs.git-ref != '' + with: + ref: ${{ github.event.inputs.git-ref }} + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ needs.setup2.outputs.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ needs.setup2.outputs.ECR_REPOSITORY }} + IMAGE_TAG: ${{ github.sha }} + run: | + cd ${{ needs.setup2.outputs.BUILD_DIR }} + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" + - name: Download task definition + run: | + aws ecs describe-task-definition --task-definition ${{ needs.setup2.outputs.ECS_TASK_DEFINITION }} --query taskDefinition > ${{ needs.setup2.outputs.ECS_TASK_DEFINITION_FILE }} + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@v1 + with: + task-definition: ${{ needs.setup2.outputs.ECS_TASK_DEFINITION_FILE }} + container-name: ${{ needs.setup2.outputs.ECS_CONTAINER_NAME }} + image: ${{ steps.build-image.outputs.image }} + + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: ${{ needs.setup2.outputs.ECS_SERVICE }} + cluster: ${{ needs.setup2.outputs.ECS_CLUSTER }} + wait-for-service-stability: true \ No newline at end of file diff --git a/.github/workflows/workflow-tester21.yml b/.github/workflows/workflow-tester21.yml new file mode 100644 index 0000000000..8e8a053818 --- /dev/null +++ b/.github/workflows/workflow-tester21.yml @@ -0,0 +1,21 @@ +name: Test 21 + +on: + workflow_dispatch: + push: + +jobs: + rpm: + runs-on: ubuntu-latest + container: + image: centos:latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup dependencies + run: | + sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-Linux-* + sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-* + yum install -y git tar curl wget sudo make yum-utils device-mapper-persistent-data lvm2 rpm-build + yum clean all + - run: echo "Success" diff --git a/.github/workflows/workflow-tester22.yml b/.github/workflows/workflow-tester22.yml new file mode 100644 index 0000000000..28fe3dd83e --- /dev/null +++ b/.github/workflows/workflow-tester22.yml @@ -0,0 +1,20 @@ +name: Test 22 # Related to https://stackoverflow.com/questions/71045674/how-to-check-if-an-optional-workflow-dispatch-input-is-set-or-not + +on: + workflow_dispatch: + inputs: + test: + description: "Test" + required: false + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Print variable if not empty + if: "${{ github.event.inputs.test != '' }}" + run: echo Test value is ${{ github.event.inputs.test }} + + - name: Print message if empty + if: "${{ github.event.inputs.test == '' }}" + run: echo Value is empty diff --git a/.github/workflows/workflow-tester23.yml b/.github/workflows/workflow-tester23.yml new file mode 100644 index 0000000000..0ade9c9470 --- /dev/null +++ b/.github/workflows/workflow-tester23.yml @@ -0,0 +1,19 @@ +name: Test 23 # Related to https://stackoverflow.com/questions/71041571/github-action-how-to-get-value-from-expression-evaluation-and-assign-it-to-the/71042503?noredirect=1#comment125620374_71042503 + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: git log -n1 --pretty='%h' + - run: echo git describe --exact-match --tags $(git log -n1 --pretty='%h') + - name: set up env var + run: | + TAG=$(echo git describe --exact-match --tags $(git log -n1 --pretty='%h')) + echo $TAG + echo "TAG=$TAG" >> $GITHUB_ENV + - name: use env var + run: echo ${{ env.TAG }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester24.yml b/.github/workflows/workflow-tester24.yml new file mode 100644 index 0000000000..75e61e5ac1 --- /dev/null +++ b/.github/workflows/workflow-tester24.yml @@ -0,0 +1,45 @@ +name: Test 24 # Related to https://stackoverflow.com/questions/71327594/github-action-js-file-return-string-to-be-saved-in-a-variable + +on: + workflow_dispatch: + +jobs: + python: + runs-on: ubuntu-latest + steps: + - name: Checkout repository content + uses: actions/checkout@v2 # Checkout the repository content to github runner. + + - name: Setup Python Version + uses: actions/setup-python@v2 + with: + python-version: 3.8 # Install the python version needed + + - name: set up env var + run: | + URL=$(python scripts/test_workflow24.py) + echo $URL + echo "URL=$URL" >> $GITHUB_ENV + + - name: use env var + run: echo ${{ env.URL }} + + node: + runs-on: ubuntu-latest + steps: + - name: Checkout repository content + uses: actions/checkout@v2 # Checkout the repository content to github runner. + + - name: Setup Node Version + uses: actions/setup-node@v2 + with: + node-version: 14 # Install the node version needed + + - name: set up env var + run: | + URL=$(node scripts/test_workflow24.js) + echo $URL + echo "URL=$URL" >> $GITHUB_ENV + + - name: use env var + run: echo ${{ env.URL }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester25.yml b/.github/workflows/workflow-tester25.yml new file mode 100644 index 0000000000..38e9345eaa --- /dev/null +++ b/.github/workflows/workflow-tester25.yml @@ -0,0 +1,28 @@ +name: Test 25 # Related to https://stackoverflow.com/questions/71341486/github-action-assign-a-variable-of-type-env-an-array-of-strings + +on: + workflow_dispatch: + +jobs: + node: + runs-on: ubuntu-latest + steps: + - name: Checkout repository content + uses: actions/checkout@v2 # Checkout the repository content to github runner. + + - name: Setup Node Version + uses: actions/setup-node@v2 + with: + node-version: 14 # Install the node version needed + + - name: set multiline env var + run: | + echo 'URL<> $GITHUB_ENV + node scripts/test_workflow25.js >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + + - name: use env var + run: echo "${{ env.URL }}" + + - name: use env var directly + run: echo "$URL" \ No newline at end of file diff --git a/.github/workflows/workflow-tester26.yml b/.github/workflows/workflow-tester26.yml new file mode 100644 index 0000000000..faddd3c682 --- /dev/null +++ b/.github/workflows/workflow-tester26.yml @@ -0,0 +1,29 @@ +name: Test 26 # Related to https://stackoverflow.com/questions/71357973/github-actions-set-two-output-names-from-custom-action-in-golang-code + +on: + workflow_dispatch: + +jobs: + Version: + name: Calculate Version + runs-on: ubuntu-latest + outputs: + repo_version_env: ${{ steps.version.outputs.repo_tag }} + ecr_version_env: ${{ steps.version.outputs.ecr_tag }} + steps: + - name: Check out code + uses: actions/checkout@v2 + - name: Calculate version + id: version + run: go run ./scripts/test_workflow26.go + + Build: + needs: + - Version + name: Build Image + runs-on: ubuntu-latest + steps: + - name: Build + run: | + echo ${{ needs.Version.outputs.ecr_version_env }} + echo ${{ needs.Version.outputs.repo_version_env }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester27.yml b/.github/workflows/workflow-tester27.yml new file mode 100644 index 0000000000..de7d394911 --- /dev/null +++ b/.github/workflows/workflow-tester27.yml @@ -0,0 +1,31 @@ +name: Test 27 # Related to https://stackoverflow.com/questions/71418790/github-action-is-failing-when-the-personal-access-token-is-passed-as-a-secret + +on: + workflow_dispatch: + +jobs: + # create-pull-request-1: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + # - uses: GuillaumeFalourd/pull-request-action@v1 + # with: + # destination_branch: "feature/test" + # pr_title: "[example] test_create_pull_request" + # pr_body: "test body." + # env: + # GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + + create-pull-request-2: + runs-on: ubuntu-latest + steps: + - name: Create pull Request + uses: TheRealWaldo/pull-request@v0.2.0 + env: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + with: + title: Automated Pull Request From main to feature/test Branch + base: feature/test + head: main + assignee: GuillaumeFalourd + body: Automated Pull Request From main to feature/test Branch \ No newline at end of file diff --git a/.github/workflows/workflow-tester28.yml b/.github/workflows/workflow-tester28.yml new file mode 100644 index 0000000000..0ee86f6e1b --- /dev/null +++ b/.github/workflows/workflow-tester28.yml @@ -0,0 +1,24 @@ +name: Test 28 # Related to https://stackoverflow.com/questions/71493577/how-can-i-access-environment-variable-set-in-external-bash-script-in-github-acti + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + - run: sh ./scripts/test_workflow28.sh + - id: jira_ticket_reject + continue-on-error: true + run: | + env # searched for it also here - it doesn't exist. + echo ${{ env.jira_ticket_exists }} # this returns nothing + if [ ${{ env.jira_ticket_exists }} == "true" ]; then + echo "Jira ticket found" + exit 0 + else + echo "Jira ticket not found" + exit 1 + fi \ No newline at end of file diff --git a/.github/workflows/workflow-tester29.yml b/.github/workflows/workflow-tester29.yml new file mode 100644 index 0000000000..230e44fc6d --- /dev/null +++ b/.github/workflows/workflow-tester29.yml @@ -0,0 +1,65 @@ +name: Test 29 # Related to https://stackoverflow.com/questions/71561915/github-action-skipped-job +on: + workflow_dispatch: + inputs: + os: + type: choice + required: true + description: the os that will be tested. + default: ANDROID + options: + - IOS + - ANDROID +jobs: + + LA_CHECKS: + strategy: + fail-fast: false + matrix: + la_checks: [[la, las331],[la2,las993]] + name: ${{ matrix.la[1] }} + # runs-on: DOCKER + runs-on: ubuntu-latest + # container: scripts + steps: + - uses: actions/checkout@v2 + # - uses: ./.github/templates/la_check + # with: + # precondition: ${{ matrix.la_checks[0] }} + + + Install_FR1: + if: ${{ always() && github.event.inputs.os == 'ANDROID' }} + needs: [LA_CHECKS] + # runs-on: DOCKER + runs-on: ubuntu-latest + # container: scripts + steps: + - uses: actions/checkout@v2 + # - uses: ./.github/templates/install + # with: + # d_id: fr1 + + FR1_EXEC: + needs: [Install_FR1] + if: needs.Install_FR1.result == 'success' + # runs-on: DOCKER + runs-on: ubuntu-latest + # container: scripts + steps: + - uses: actions/checkout@v2 + # - uses: ./.github/templates/device + # with: + # d_id: fr1 + + Uninstall_FR1: + # if: ${{ always() && github.event.inputs.os == 'ANDROID' }} + needs: [FR1_EXEC] + # runs-on: DOCKER + runs-on: ubuntu-latest + # container: scripts + steps: + - uses: actions/checkout@v2 + # - uses: ./.github/templates/uninstall + # with: + # device_id: fr1 \ No newline at end of file diff --git a/.github/workflows/workflow-tester30.yml b/.github/workflows/workflow-tester30.yml new file mode 100644 index 0000000000..11abfacd33 --- /dev/null +++ b/.github/workflows/workflow-tester30.yml @@ -0,0 +1,27 @@ +name: Test 30 # Related to https://stackoverflow.com/questions/71593861/how-to-get-github-actions-matrix-job-name-within-job + +on: + # pull_request: + # types: [opened, synchronize] + workflow_dispatch: + # push: + +jobs: + my-job: + name: OS ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-18.04 + - ubuntu-20.04 + steps: + - run: echo ${{ github.job }} + - run: | + JOB_NAME="OS ${{ matrix.os }}" + echo $JOB_NAME + echo "JOB_NAME=$JOB_NAME" >> $GITHUB_ENV + + - name: Print JOB_NAME + run: | + echo "JOB NAME:" ${{ env.JOB_NAME }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester31.yml b/.github/workflows/workflow-tester31.yml new file mode 100644 index 0000000000..edd9644375 --- /dev/null +++ b/.github/workflows/workflow-tester31.yml @@ -0,0 +1,25 @@ +name: Test 31 # Related to https://stackoverflow.com/questions/71961921/specify-runner-to-be-used-depending-on-condition-in-a-github-actions-workflow?noredirect=1#comment127177119_71961921 + +on: + workflow_dispatch: + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + runner: ${{ steps.step1.outputs.runner }} + steps: + - name: Check branch + id: step1 + run: | + if [ ${{ github.ref }} == 'refs/heads/main' ]; then + echo "::set-output name=runner::ubuntu-latest" + else + echo "::set-output name=runner::macos-latest" + fi + + job1: + needs: [setup] + runs-on: ${{ needs.setup.outputs.runner }} + steps: + - run: echo "My runner is ${{ needs.setup.outputs.runner }}" \ No newline at end of file diff --git a/.github/workflows/workflow-tester32.yml b/.github/workflows/workflow-tester32.yml new file mode 100644 index 0000000000..94e861c767 --- /dev/null +++ b/.github/workflows/workflow-tester32.yml @@ -0,0 +1,10 @@ +name: Test 32 # Related to https://stackoverflow.com/questions/72067650/how-to-install-docker-on-github-actions + +on: + workflow_dispatch: + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - run: docker --version \ No newline at end of file diff --git a/.github/workflows/workflow-tester33.yml b/.github/workflows/workflow-tester33.yml new file mode 100644 index 0000000000..914aee1610 --- /dev/null +++ b/.github/workflows/workflow-tester33.yml @@ -0,0 +1,19 @@ +name: Test 33 # Related to https://stackoverflow.com/questions/72333992/why-a-static-array-doesnt-work-with-github-contains-workflow-expression + +on: + workflow_dispatch: + +jobs: + setup: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + foo: [ '1', '2', '3', '4', '5', '6', '7', '8' ] + steps: + - name: OK + if: contains(fromJson('["6", "7", "8"]'), matrix.foo) + run: echo OK + - name: NOK + if: ${{ ! contains(fromJson('["6", "7", "8"]'), matrix.foo) }} + run: echo NOK \ No newline at end of file diff --git a/.github/workflows/workflow-tester34.yml b/.github/workflows/workflow-tester34.yml new file mode 100644 index 0000000000..3a874d2381 --- /dev/null +++ b/.github/workflows/workflow-tester34.yml @@ -0,0 +1,17 @@ +name: Test 34 # Related to https://stackoverflow.com/questions/72360263/how-to-checkout-a-repository-outside-of-the-workspace-in-github-actions?noredirect=1#comment127834668_72360263 + +on: + workflow_dispatch: + +jobs: + setup: + runs-on: ubuntu-latest + steps: + - uses: GuillaumeFalourd/clone-github-repo-action@v3 + with: + owner: GuillaumeFalourd + repository: formulas-4-tests + path-to-clone: ${{ github.workspace }}/test + - run: | + cd ${{ github.workspace }}/test + ls -lha diff --git a/.github/workflows/workflow-tester35.yml b/.github/workflows/workflow-tester35.yml new file mode 100644 index 0000000000..7cfef0c702 --- /dev/null +++ b/.github/workflows/workflow-tester35.yml @@ -0,0 +1,27 @@ +name: Test 35 # Related to https://stackoverflow.com/questions/72379994/github-actions-check-empty-dispatch-input + + +on: + workflow_dispatch: + inputs: + input1: + description: first input + required: false + type: string + input2: + description: second input + required: false + type: string + +jobs: + jobA: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' && github.event.inputs.input1 != '' + steps: + - run: echo "Input 1 not empty" + + jobB: + runs-on: ubuntu-latest + if: github.event_name != 'workflow_dispatch' || github.event.inputs.input1 == '' + steps: + - run: echo "Input 1 is empty" \ No newline at end of file diff --git a/.github/workflows/workflow-tester36.yml b/.github/workflows/workflow-tester36.yml new file mode 100644 index 0000000000..fc82ea20c4 --- /dev/null +++ b/.github/workflows/workflow-tester36.yml @@ -0,0 +1,16 @@ +name: Test 36 # Related to https://stackoverflow.com/questions/72532083/how-to-access-this-json-object-field-in-github-actions + +on: + workflow_dispatch: + push: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Access GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + diff --git a/.github/workflows/workflow-tester37.yml b/.github/workflows/workflow-tester37.yml new file mode 100644 index 0000000000..da6b1ae329 --- /dev/null +++ b/.github/workflows/workflow-tester37.yml @@ -0,0 +1,30 @@ +name: Test 37 #Related to https://stackoverflow.com/questions/72551501/using-if-statements-in-actions + +on: + workflow_dispatch: + inputs: + username: + required: false + type: string + +jobs: + test: + name: Pass input and secrets to my-action + runs-on: ubuntu-latest + steps: + - name: Inputs username (workflow call) + if: ${{ inputs.username }} != '' + run: echo ${{ inputs.username }} + + - name: Inputs username (workflow dispatch) + if: ${{ github.event.inputs.username }} != '' + run: echo ${{ github.event.inputs.username }} + + - uses: actions/checkout@v2.3.4 # Necessary to access local action + + - name: Local Action Call Without Input + id: local-action + uses: ./.github/actions/local-action + with: + name: ${{ inputs.username }} + diff --git a/.github/workflows/workflow-tester38.yml b/.github/workflows/workflow-tester38.yml new file mode 100644 index 0000000000..ff92800da8 --- /dev/null +++ b/.github/workflows/workflow-tester38.yml @@ -0,0 +1,22 @@ +name: Test 38 # Related to https://stackoverflow.com/questions/72558396/custom-default-value-for-github-actions + +on: + workflow_dispatch: + inputs: + release-notes: + description: 'Release Notes' + required: false + # default: ${{ github.actor }} + +env: + DEFAULT_NOTES: Build by ${{ github.actor }} + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Print default value + if: ${{ inputs.release-notes }} != '' + run: echo $DEFAULT_NOTES + + diff --git a/.github/workflows/workflow-tester39.yml b/.github/workflows/workflow-tester39.yml new file mode 100644 index 0000000000..dcae2e8d64 --- /dev/null +++ b/.github/workflows/workflow-tester39.yml @@ -0,0 +1,22 @@ +name: Test 39 # Related to https://stackoverflow.com/questions/72613951/in-a-github-action-can-i-extract-a-recurring-variable-or-condition + +on: + push: + +env: + BRANCH: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/features/lrd') }} + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Check branch and print it + if: ${{ env.BRANCH }} + run: echo ${{ env.BRANCH }} + + # job2: + # runs-on: ubuntu-latest + # if: ${{ env.BRANCH }} # Won't work + # steps: + # - name: Print branch + # run: echo ${{ env.BRANCH }} diff --git a/.github/workflows/workflow-tester4.yml b/.github/workflows/workflow-tester4.yml index 21b67ce177..4fa644cb64 100644 --- a/.github/workflows/workflow-tester4.yml +++ b/.github/workflows/workflow-tester4.yml @@ -1,6 +1,9 @@ name: Test 4 -on: [push] +on: + push: + branches: + - 'dev' jobs: test: @@ -10,4 +13,4 @@ jobs: - name: Run Commands run: | echo "Hello World" - echo "This workflow only runs for push to the MAIN branch" \ No newline at end of file + echo "This workflow only runs for push to the DEV branch" \ No newline at end of file diff --git a/.github/workflows/workflow-tester40.yml b/.github/workflows/workflow-tester40.yml new file mode 100644 index 0000000000..09ff9ce276 --- /dev/null +++ b/.github/workflows/workflow-tester40.yml @@ -0,0 +1,42 @@ +name: Test 40 # Related to https://stackoverflow.com/questions/72633058/parameterize-runs-on-value-for-github-action + +on: + workflow_dispatch: + +env: + MAC_OS_RUNNER: ${{ secrets.MAC_OS_RUNNER }} + +jobs: + test-matrix: + runs-on: ${{ matrix.test }} + strategy: + matrix: + # test: ${{ env.MAC_OS_RUNNER }} + os: [ubuntu-latest, windows-latest, macos-latest] + python: [2.7, 3.7, 3.8, 3.9] + steps: + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + - run: | + echo $OSTYPE + python --version + shell: bash + + # test-include: + # runs-on: ubuntu-latest + # strategy: + # matrix: + # org: [apples, bananas, carrots] #Array of org mnemonics to use below + # include: + # # includes a new variable for each org (this is effectively a switch statement) + # - org: apples + # test_secret: MAC_OS_RUNNER + # - org: bananas + # test_secret: MAC_OS_RUNNER + # - org: carrots + # test_secret: MAC_OS_RUNNER + # steps: + # - uses: actions/checkout@v2 + # - name: Install SFDX CLI and authorize org + # run: ${{ secrets[matrix.MAC_OS_RUNNER] }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester41.yml b/.github/workflows/workflow-tester41.yml new file mode 100644 index 0000000000..ff76c94dc3 --- /dev/null +++ b/.github/workflows/workflow-tester41.yml @@ -0,0 +1,60 @@ +name: Test 41 # Related to https://stackoverflow.com/questions/72704563/github-action-echo-within-an-expression + +on: + workflow_dispatch: + +jobs: + changes: + name: Detect changes + runs-on: ubuntu-latest + outputs: + # aws: ${{ steps.filter.outputs.aws }} + # azure: ${{ steps.filter.outputs.azure }} + # gcp: ${{ steps.filter.outputs.gcp }} + aws: 'true' + azure: 'true' + gcp: 'true' + steps: + - name: Checkout source code + uses: actions/checkout@v2 + - name: Check for changes + uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + aws: + - added|modified: 'aws/**' + azure: + - added|modified: 'azure/**' + gcp: + - added|modified: 'gcp/**' + + zip_files: + runs-on: ubuntu-latest + needs: [ changes] + if: ${{ (needs.changes.outputs.aws == 'true') || (needs.changes.outputs.azure == 'true') || (needs.changes.outputs.gcp == 'true') }} + steps: + - uses: actions/checkout@v2 + - id: check + run: | + if [ '${{ needs.changes.outputs.aws }}' == 'true' ]; then + echo "::set-output name=aws::aws" + fi + if [ '${{ needs.changes.outputs.azure }}' == 'true' ]; then + echo "::set-output name=azure::azure" + fi + if [ '${{ needs.changes.outputs.gcp }}' == 'true' ]; then + echo "::set-output name=gcp::gcp" + fi + - name: check values + run: | + echo ${{steps.check.outputs.aws}} + echo ${{steps.check.outputs.azure}} + echo ${{steps.check.outputs.gcp}} + - uses: montudor/action-zip@v1 + with: + args: zip -qq -r result.zip "${{steps.check.outputs.aws}}" "${{steps.check.outputs.azure}}" "${{steps.check.outputs.gcp}}" + - uses: actions/upload-artifact@v4.4.0 + with: + name: my-artifact + path: ${{ github.workspace }}/result.zip \ No newline at end of file diff --git a/.github/workflows/workflow-tester42.yml b/.github/workflows/workflow-tester42.yml new file mode 100644 index 0000000000..f1b3ff5e8e --- /dev/null +++ b/.github/workflows/workflow-tester42.yml @@ -0,0 +1,15 @@ +name: Test 42 # Related to https://stackoverflow.com/questions/72743504/why-shell-for-loop-doesnt-work-in-github-actions + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: run a loop + run: | + for run in {1..3}; do + date;sleep 1; + done + shell: bash \ No newline at end of file diff --git a/.github/workflows/workflow-tester43.yml b/.github/workflows/workflow-tester43.yml new file mode 100644 index 0000000000..256a94ac81 --- /dev/null +++ b/.github/workflows/workflow-tester43.yml @@ -0,0 +1,36 @@ +name: Test 43 # Related to https://stackoverflow.com/questions/72800296/use-outputs-of-multiline-run-commands-in-github-actions + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Test + if: github.ref == 'refs/heads/main' + run: | + # Config variables + VERSION_NAME=$(echo MY_VERSION) + LATEST_TAG=$(git tag --list | head -n 1) + CHANGE_LOG=$(echo changelog $LATEST_TAG) + + # Check variables + echo $VERSION_NAME + echo $LATEST_TAG + echo $CHANGE_LOG + echo $GITHUB_RUN_NUMBER + shell: bash + + job2: + runs-on: ubuntu-latest + steps: + - run: | + echo ${GITHUB_RUN_NUMBER} + echo ${{ github.run_number }} + echo $GITHUB_RUN_NUMBER + TEST=$((1000 + $GITHUB_RUN_NUMBER)) + echo $TEST \ No newline at end of file diff --git a/.github/workflows/workflow-tester44.yml b/.github/workflows/workflow-tester44.yml new file mode 100644 index 0000000000..fcf8fc350c --- /dev/null +++ b/.github/workflows/workflow-tester44.yml @@ -0,0 +1,23 @@ +name: Test 44 # Related to https://stackoverflow.com/questions/72805799/add-github-run-number-to-a-file-in-github-repo + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - name: Execute Python script to update test.py file + run: python .github/scripts/update_file.py + env: + WORKSPACE: ${{ github.workspace }} + GITHUB_RUN_NUMBER: ${{ github.run_number }} + + - run: cat test.py \ No newline at end of file diff --git a/.github/workflows/workflow-tester45.yml b/.github/workflows/workflow-tester45.yml new file mode 100644 index 0000000000..3a15706beb --- /dev/null +++ b/.github/workflows/workflow-tester45.yml @@ -0,0 +1,17 @@ +name: Test 45 # Related to https://stackoverflow.com/questions/72803738/how-to-break-branch-name-for-building-alpha + +on: + push: + branches: [fix/NN-*] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Extract branch number + id: version + run: | + BRANCH=${GITHUB_REF} + echo $BRANCH + BUILD_NUMBER="${BRANCH//refs\/heads\/fix\/NN-/}" + echo $BUILD_NUMBER \ No newline at end of file diff --git a/.github/workflows/workflow-tester46.yml b/.github/workflows/workflow-tester46.yml new file mode 100644 index 0000000000..27a0c6435d --- /dev/null +++ b/.github/workflows/workflow-tester46.yml @@ -0,0 +1,14 @@ +name: Test 46 # Related to https://stackoverflow.com/questions/73041315/is-there-a-way-to-override-github-context-variables-in-github-actions + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - run: echo $GITHUB_EVENT_NAME + - run: echo "GITHUB_EVENT_NAME=1234" >> $GITHUB_ENV + - run: echo "${{ env.GITHUB_EVENT_NAME }}" + - run: echo $GITHUB_EVENT_NAME + \ No newline at end of file diff --git a/.github/workflows/workflow-tester47.yml b/.github/workflows/workflow-tester47.yml new file mode 100644 index 0000000000..118cb551bd --- /dev/null +++ b/.github/workflows/workflow-tester47.yml @@ -0,0 +1,40 @@ +name: Test 47 + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: windows-latest + steps: + - run: c:\windows\system32\wbem\wmic.exe csproduct get uuid + + - name: Checkout repository content + uses: actions/checkout@v3 + + - name: Setup Python Version + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Execute Python script + run: python shell.py + + + job2: + runs-on: windows-latest + steps: + - run: /c/windows/system32/wbem/wmic.exe csproduct get uuid + shell: bash + + - name: Checkout repository content + uses: actions/checkout@v3 + + - name: Setup Python Version + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Execute Python script + run: python shell.py + shell: bash \ No newline at end of file diff --git a/.github/workflows/workflow-tester48.yml b/.github/workflows/workflow-tester48.yml new file mode 100644 index 0000000000..159e52c126 --- /dev/null +++ b/.github/workflows/workflow-tester48.yml @@ -0,0 +1,18 @@ +name: Test 48 #Related to SO https://stackoverflow.com/questions/73193320/use-input-parameter-as-condition-to-skip-a-step + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 # Necessary to access local action + - name: Test1 Action Call TRUE + id: test1-action-true + uses: ./.github/actions/test1 + with: + dry_run: true + - name: Test1 Action Call FALSE + id: test1-action-false + uses: ./.github/actions/test1 \ No newline at end of file diff --git a/.github/workflows/workflow-tester49.yml b/.github/workflows/workflow-tester49.yml new file mode 100644 index 0000000000..1e1782b406 --- /dev/null +++ b/.github/workflows/workflow-tester49.yml @@ -0,0 +1,18 @@ +name: Test 49 #Related to SO https://stackoverflow.com/questions/73213189/cannot-set-a-env-var-when-using-macos-runner + +on: + workflow_dispatch: + +jobs: + job1: + runs-on: macos-latest + steps: + - name: Set variable + run: | + RUNDATEOSX=$(date -j -v-2d +%Y%m%d) + echo "RUNDATEOSX=$RUNDATEOSX" >> $GITHUB_ENV + + - name: Print variable + run: | + echo "RUNDATEOSX:" ${{ env.RUNDATEOSX }} + echo "RUNDATEOSX:" $RUNDATEOSX \ No newline at end of file diff --git a/.github/workflows/workflow-tester50.yml b/.github/workflows/workflow-tester50.yml new file mode 100644 index 0000000000..35cf8a9ac7 --- /dev/null +++ b/.github/workflows/workflow-tester50.yml @@ -0,0 +1,15 @@ +name: Test 50 #Related to SO https://stackoverflow.com/questions/73232652/validate-crontab-with-github-action + +on: + workflow_dispatch: + +env: + CRONTAB_FILE : './crontab' + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Run crontab command from file + run : crontab < $CRONTAB_FILE \ No newline at end of file diff --git a/.github/workflows/workflow-tester51.yml b/.github/workflows/workflow-tester51.yml new file mode 100644 index 0000000000..a9708ad616 --- /dev/null +++ b/.github/workflows/workflow-tester51.yml @@ -0,0 +1,13 @@ +name: Test 51 #Related to SO https://stackoverflow.com/questions/73240847/github-action-workflow-executed-without-being-called-in-on-statement + +on: + pull_request_review: + types: [submitted, edited] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - run: | + echo "Triggered" + echo ${{ github.event }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester52-reusable.yml b/.github/workflows/workflow-tester52-reusable.yml new file mode 100644 index 0000000000..2b10a8d73d --- /dev/null +++ b/.github/workflows/workflow-tester52-reusable.yml @@ -0,0 +1,21 @@ +name: Test 52 (reusable) + +on: + workflow_dispatch: + workflow_call: + inputs: + input_var: + required: true + type: string + another_input_var: + required: true + type: string + +jobs: + the_job: + runs-on: ubuntu-latest + steps: + - name: Print inputs + run: | + echo "input_var: ${{ inputs.input_var }}" + echo "another_input_var: ${{ inputs.another_input_var }}" \ No newline at end of file diff --git a/.github/workflows/workflow-tester52.yml b/.github/workflows/workflow-tester52.yml new file mode 100644 index 0000000000..f49808f20d --- /dev/null +++ b/.github/workflows/workflow-tester52.yml @@ -0,0 +1,31 @@ +name: Test 52 #Related to SO https://stackoverflow.com/questions/73305126/passing-variable-inputs-to-a-resuable-workflow + +on: + workflow_dispatch: + +env: + SOME_VAR: bla_bla_bla + ANOTHER_VAR: stuff_stuff + +jobs: + print: + runs-on: ubuntu-latest + outputs: + some_var: ${{ steps.step1.outputs.some_var }} + another_var: ${{ steps.step1.outputs.another_var }} + steps: + - name: Print inputs passed to the reusable workflow + id: step1 + run: | + echo "some var: $SOME_VAR" + echo "::set-output name=some_var::$SOME_VAR" + echo "another var: $ANOTHER_VAR" + echo "::set-output name=another_var::$ANOTHER_VAR" + + call_reusable: + needs: + - print + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester52-reusable.yml@main + with: + input_var: ${{ needs.print.outputs.some_var }} + another_input_var: ${{ needs.print.outputs.another_var }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester53.yml b/.github/workflows/workflow-tester53.yml new file mode 100644 index 0000000000..515ed36f95 --- /dev/null +++ b/.github/workflows/workflow-tester53.yml @@ -0,0 +1,16 @@ +name: Test 53 #Related to SO https://stackoverflow.com/questions/73591118/github-actions-dependent-jobs-not-running-sequentially + +on: + workflow_dispatch: + +jobs: + laravel_tests: + runs-on: ubuntu-latest + steps: + - run: echo test + + forge_deploy: + needs: laravel_tests + runs-on: ubuntu-latest + steps: + - run: echo test \ No newline at end of file diff --git a/.github/workflows/workflow-tester54.yml b/.github/workflows/workflow-tester54.yml new file mode 100644 index 0000000000..fae3de83a7 --- /dev/null +++ b/.github/workflows/workflow-tester54.yml @@ -0,0 +1,61 @@ +name: Test 54 #Related to SO https://stackoverflow.com/questions/73611201/how-to-get-inputs-in-github-yml + +on: + #push: + workflow_dispatch: + inputs: + test1: + description: test1 + required: false + default: false + type: boolean + test2: + description: test2 + required: false + default: true + type: boolean + +jobs: + job1: # will always run + runs-on: ubuntu-latest + steps: + - run: | + echo ${{ inputs.test1 }} + echo ${{ inputs.test2 }} + echo ${{ github.event_name }} + + job2: # will only run on a workflow_dispatch event, if test1 input is true + runs-on: ubuntu-latest + if: ${{ inputs.test1 }} + steps: + - run: | + echo ${{ inputs.test1 }} + echo ${{ inputs.test2 }} + echo ${{ github.event_name }} + + job3: # will only run on a workflow_dispatch event, if test2 input is true + runs-on: ubuntu-latest + if: ${{ inputs.test2 }} + steps: + - run: | + echo ${{ inputs.test1 }} + echo ${{ inputs.test2 }} + echo ${{ github.event_name }} + + job4: # will only run on a push event + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' }} + steps: + - run: | + echo ${{ inputs.test1 }} + echo ${{ inputs.test2 }} + echo ${{ github.event_name }} + + job5: # will only run on a push event OR if inputs.test2 is true on a workflow_dispatch event + runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' || inputs.test2 }} + steps: + - run: | + echo ${{ inputs.test1 }} + echo ${{ inputs.test2 }} + echo ${{ github.event_name }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester55.yml b/.github/workflows/workflow-tester55.yml new file mode 100644 index 0000000000..4adc79229f --- /dev/null +++ b/.github/workflows/workflow-tester55.yml @@ -0,0 +1,33 @@ +name: Test 55 #Related to SO https://stackoverflow.com/questions/73643836/prevent-a-job-in-github-action-workflow-file-to-run-in-case-of-an-event + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub Event + run: echo ${{ github.event }} + + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + job2: + runs-on: ubuntu-latest + if: github.event.pull_request.edited == true + steps: + - run: | + echo "Pull Request EDITED" + echo ${{ github.event }} + + job3: + runs-on: ubuntu-latest + if: github.event.pull_request.edited != true + steps: + - run: | + echo "Pull Request NOT EDITED" + echo ${{ github.event }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester56.yml b/.github/workflows/workflow-tester56.yml new file mode 100644 index 0000000000..c76b7328f0 --- /dev/null +++ b/.github/workflows/workflow-tester56.yml @@ -0,0 +1,27 @@ +name: Test 56 #Related to SO https://stackoverflow.com/questions/73727910/invalid-workflow-file-github-actions-cf-cli + +on: + # push: + # branches: + # - main + workflow_dispatch: + + +jobs: + # build: + # runs-on: ubuntu-18.04 + # Build your app here + + deploy: + runs-on: ubuntu-18.04 + needs: build + + steps: + - uses: citizen-of-planet-earth/cf-cli-action@master + with: + cf_api: https://api.my-cloud-foundry.com + cf_username: ${{ secrets.CF_USER }} + cf_password: ${{ secrets.CF_PASSWORD }} + cf_org: AwesomeApp + cf_space: Development + command: push -f manifest-dev.yml diff --git a/.github/workflows/workflow-tester57.yml b/.github/workflows/workflow-tester57.yml new file mode 100644 index 0000000000..ba29c308d6 --- /dev/null +++ b/.github/workflows/workflow-tester57.yml @@ -0,0 +1,34 @@ +name: Test 57 #Related to SO https://stackoverflow.com/questions/73890119/gitaction-trigger-workflow-on-pr-approval-and-when-base-branch-is-main-and-csv + +on: + pull_request_review: + types: [submitted] + branches: + - main + +jobs: + job1: + if: github.event.review.state == 'approved' && startsWith(github.event,review.pull_request.base.ref, 'main') + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2.2.0 + - name: Check if *.csv is modified + uses: dorny/paths-filter@v2.2.1 + id: changes + with: + filters: | + csv: + - 'data/*.csv' + - name: Run process bmv script + if: ${{ steps.changes.outputs.csv == 'true' }} + run: | + echo "-Started running script-" + + github-context: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" \ No newline at end of file diff --git a/.github/workflows/workflow-tester58.yml b/.github/workflows/workflow-tester58.yml new file mode 100644 index 0000000000..d9df22f39b --- /dev/null +++ b/.github/workflows/workflow-tester58.yml @@ -0,0 +1,36 @@ +name: Test Install Poetry Action # Related to https://github.com/snok/install-poetry/issues/94 + +on: + workflow_dispatch: + #push: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-windows-131: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install and configure Poetry + uses: snok/install-poetry@v1.3.1 + with: + version: 1.2.1 + virtualenvs-create: false + + build-windows-132: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2.3.4 + - uses: actions/setup-python@v4 + with: + python-version: 3.8 + - name: Install and configure Poetry + uses: snok/install-poetry@v1.3.2 + with: + version: 1.2.1 + virtualenvs-create: false \ No newline at end of file diff --git a/.github/workflows/workflow-tester59.yml b/.github/workflows/workflow-tester59.yml new file mode 100644 index 0000000000..8123370121 --- /dev/null +++ b/.github/workflows/workflow-tester59.yml @@ -0,0 +1,77 @@ +name: Test 59 # Related to https://stackoverflow.com/questions/74057478/github-action-secrets-environnment-cant-be-retreived + +on: + workflow_dispatch: + inputs: + input: + description: "test" + required: false + default: "test" + #push: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + # job1: + # runs-on: ubuntu-latest + # environment: test + # env: + # REPO_ENV_SECRET: ${{ secrets.REPO_ENV_SECRET }} + # steps: + # - name: Show repo env secret + # run: | + # echo ${{ env.REPO_ENV_SECRET }} + # echo ${{ secrets.REPO_ENV_SECRET }} + # echo "Secret value env:" ${{ env.REPO_ENV_SECRET }} | sed 's/./& /g' + # echo "Secret value secret:" ${{ secrets.REPO_ENV_SECRET }} | sed 's/./& /g' + # echo ${{ env.NO_SECRET }} + # echo ${{ secrets.NO_SECRET }} + + job1: + runs-on: ubuntu-latest + environment: + name: test + env: + REPO_ENV_SECRET: ${{ secrets.REPO_ENV_SECRET }} + steps: + - name: Show repo env secret + run: | + echo ${{ env.REPO_ENV_SECRET }} + echo ${{ secrets.REPO_ENV_SECRET }} + echo "Secret value env:" ${{ env.REPO_ENV_SECRET }} | sed 's/./& /g' + echo "Secret value secret:" ${{ secrets.REPO_ENV_SECRET }} | sed 's/./& /g' + echo ${{ env.NO_SECRET }} + echo ${{ secrets.NO_SECRET }} + + job2: + runs-on: ubuntu-latest + environment: + name: ${{ inputs.input }} + env: + REPO_ENV_SECRET: ${{ secrets.REPO_ENV_SECRET }} + steps: + - name: Show repo env secret + run: | + echo ${{ env.REPO_ENV_SECRET }} + echo ${{ secrets.REPO_ENV_SECRET }} + echo "Secret value env:" ${{ env.REPO_ENV_SECRET }} | sed 's/./& /g' + echo "Secret value secret:" ${{ secrets.REPO_ENV_SECRET }} | sed 's/./& /g' + echo ${{ env.NO_SECRET }} + echo ${{ secrets.NO_SECRET }} + + # job4: + # runs-on: ubuntu-latest + # environment: ${{ inputs.input }} + # env: + # REPO_ENV_SECRET: ${{ secrets.REPO_ENV_SECRET }} + # steps: + # - name: Show repo env secret + # run: | + # echo ${{ env.REPO_ENV_SECRET }} + # echo ${{ secrets.REPO_ENV_SECRET }} + # echo "Secret value env:" ${{ env.REPO_ENV_SECRET }} | sed 's/./& /g' + # echo "Secret value secret:" ${{ secrets.REPO_ENV_SECRET }} | sed 's/./& /g' + # echo ${{ env.NO_SECRET }} + # echo ${{ secrets.NO_SECRET }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester60.yml b/.github/workflows/workflow-tester60.yml new file mode 100644 index 0000000000..393bffc2a5 --- /dev/null +++ b/.github/workflows/workflow-tester60.yml @@ -0,0 +1,45 @@ +name: Test 60 # Related to https://stackoverflow.com/questions/74072206/github-actions-use-variables-in-matrix-definition + +on: + #push: + workflow_dispatch: + inputs: + test1: + description: "Test1" + required: false + default: "test1" + test2: + description: "Test2" + required: false + default: "test2" + test3: + description: "Test3" + required: false + default: "test3" + +env: + CARGO_TERM_COLOR: always + ZEROCOPY_MSRV: 1.61.0 + ZEROCOPY_CURRENT_STABLE: 1.64.0 + ZEROCOPY_CURRENT_NIGHTLY: nightly-2022-09-26 + +jobs: + build_test: + runs-on: ubuntu-latest + strategy: + matrix: + # See `INTERNAL.md` for an explanation of these pinned toolchain versions. + channel: [ "${{ inputs.test1 }}", "${{ inputs.test2 }}", "${{ inputs.test3 }}" ] + target: [ "i686-unknown-linux-gnu", "x86_64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "aarch64-unknown-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc64-unknown-linux-gnu", "wasm32-wasi" ] + features: [ "" , "alloc,simd", "alloc,simd,simd-nightly" ] + exclude: + # Exclude any combination which uses a non-nightly toolchain but enables nightly features. + - channel: ${{ inputs.test1 }} + features: "alloc,simd,simd-nightly" + - channel: ${{ inputs.test2 }} + features: "alloc,simd,simd-nightly" + steps: + - run: | + echo ${{ matrix.channel }} + echo ${{ matrix.target }} + echo ${{ matrix.features }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester61.yml b/.github/workflows/workflow-tester61.yml new file mode 100644 index 0000000000..1248566ac0 --- /dev/null +++ b/.github/workflows/workflow-tester61.yml @@ -0,0 +1,16 @@ +name: Test 61 # Related to https://stackoverflow.com/questions/74074371/boolean-input-not-passed-correctly-to-reusable-workflow + +on: + workflow_dispatch: + inputs: + push_to_stg: + description: "test" + type: boolean + default: false + required: true + +jobs: + main: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester62.yml@main + with: + stg_image_build: ${{ inputs.push_to_stg }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester62.yml b/.github/workflows/workflow-tester62.yml new file mode 100644 index 0000000000..f69e7378bf --- /dev/null +++ b/.github/workflows/workflow-tester62.yml @@ -0,0 +1,31 @@ +name: Test 62 reusable # Related to https://stackoverflow.com/questions/74074371/boolean-input-not-passed-correctly-to-reusable-workflow + +on: + workflow_call: + inputs: + stg_image_build: + description: "Build and push image to staging registry" + type: boolean + default: false + required: true + +jobs: + reusable-job1: # will always run + runs-on: ubuntu-latest + steps: + - run: | + echo ${{ inputs.stg_image_build }} + + reusable-job2: # will only run on a workflow_dispatch event, if stg_image_build input is true + runs-on: ubuntu-latest + if: ${{ inputs.stg_image_build }} + steps: + - run: | + echo ${{ inputs.stg_image_build }} + + reusable-job3: # will only run on a workflow_dispatch event, if stg_image_build input is false + runs-on: ubuntu-latest + if: ${{ ! inputs.stg_image_build }} + steps: + - run: | + echo ${{ inputs.stg_image_build }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester63.yml b/.github/workflows/workflow-tester63.yml new file mode 100644 index 0000000000..b746bcf692 --- /dev/null +++ b/.github/workflows/workflow-tester63.yml @@ -0,0 +1,75 @@ +name: Test 63 # Related to https://stackoverflow.com/questions/74117204/how-to-generate-a-new-string-by-combine-github-action-workflow-variables + +on: + #push: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Check context var + run: | + echo '${{ github.event.head_commit.message }}' + echo '${{ github.sha }}' + +# echo MESSAGE_SHA='${{ github.event.head_commit.message }}'-'${{ github.sha }}' >> $GITHUB_ENV + + - name: Setup env var + run: | + MESSAGE=$(cat << EOF + '${{ github.event.head_commit.message }}' + -'${{ github.sha }}' + EOF + ) + echo MESSAGE_SHA=$MESSAGE >> $GITHUB_ENV + + - name: Check env var + run: | + echo ${{ env.MESSAGE_SHA }} + +# Testing same implementation for OUTPUT + + - name: Setup output var + id: test1 + run: | + MESSAGE=$(cat << EOF + '${{ github.event.head_commit.message }}' + -'${{ github.sha }}' + EOF + ) + echo MESSAGE_SHA=$MESSAGE >> $GITHUB_OUTPUT + + - name: Check output var + run: | + echo ${{steps.test1.outputs.MESSAGE_SHA}} + +# Testing other syntaxes + + - name: Setup output var2 + id: test2 + run: echo "TEST2=first line\n second line\n third line" >> $GITHUB_OUTPUT + + - name: Check output var2 + run: | + echo ${{steps.test2.outputs.TEST2}} #Will keep the n from the \n + echo -e "${{steps.test2.outputs.TEST2}}" #Will break the line from the \n + + - name: Setup output var3 + id: test3 + run: | + echo "TEST3=first line \ + second line \ + third line" >> $GITHUB_OUTPUT + + - name: Check output var3 + run: echo ${{steps.test3.outputs.TEST3}} + + - name: Setup output var4 + id: test4 + continue-on-error: true + run: echo TEST4=$(echo -e "first line\n second line\n third line") >> $GITHUB_OUTPUT + + - name: Check output var4 + run: | + echo ${{steps.test4.outputs.TEST4}} diff --git a/.github/workflows/workflow-tester64.yml b/.github/workflows/workflow-tester64.yml new file mode 100644 index 0000000000..e166b8a2d4 --- /dev/null +++ b/.github/workflows/workflow-tester64.yml @@ -0,0 +1,29 @@ +name: Test 64 # Related to https://stackoverflow.com/questions/74125082/new-format-of-output-in-custom-github-actions-since-set-output-is-going-to-be-de + +on: + #push: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Checkout repository content + uses: actions/checkout@v3 # Checkout the repository content to github runner. + + - name: Setup Python Version + uses: actions/setup-python@v2 + with: + python-version: 3.8 # Install the python version needed + + - name: Execute Python script # Run the run.py to get the latest data + id: test1 + run: python new-output.py + + - name: Check output + run: | + echo ${{steps.test1.outputs.test}} + + - name: Check env + run: | + echo ${{env.TEST}} \ No newline at end of file diff --git a/.github/workflows/workflow-tester65.yml b/.github/workflows/workflow-tester65.yml new file mode 100644 index 0000000000..035b0f6552 --- /dev/null +++ b/.github/workflows/workflow-tester65.yml @@ -0,0 +1,17 @@ +name: Test 65 # Related to https://stackoverflow.com/questions/18995854/how-can-i-use-github-api-to-get-all-tags-or-releases-for-a-project + +on: + #push: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - run: | + curl \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $TOKEN" \ + https://api.github.com/repos/GuillaumeFalourd/poc-github-actions/tags + env: + TOKEN: ${{ secrets.ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester66.yml b/.github/workflows/workflow-tester66.yml new file mode 100644 index 0000000000..b93c78c2d6 --- /dev/null +++ b/.github/workflows/workflow-tester66.yml @@ -0,0 +1,39 @@ +name: Test 66 # Related to https://stackoverflow.com/questions/74157458/git-throws-error-if-nothing-to-commit-how-to-surpress + +on: + #push: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: date > report.txt + - run: | + if [[ `git status --porcelain` ]]; then + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "generated checkout workflow file" + git push + else + echo "WARNING: No changes were detected. git commit push action aborted." + fi + shell: bash + + job2: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: | + if [[ `git status --porcelain` ]]; then + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "generated checkout workflow file" + git push + else + echo "WARNING: No changes were detected. git commit push action aborted." + fi + shell: bash \ No newline at end of file diff --git a/.github/workflows/workflow-tester67.yml b/.github/workflows/workflow-tester67.yml new file mode 100644 index 0000000000..7a173190cd --- /dev/null +++ b/.github/workflows/workflow-tester67.yml @@ -0,0 +1,15 @@ +name: Test 67 # Related to https://stackoverflow.com/questions/74188647/add-variable-value-to-github-action-name + +on: + #push: + workflow_dispatch: + +env: + REGISTRY: ghcr.io + +jobs: + Publish: + runs-on: ubuntu-latest + steps: + - name: Log into Container registry ${{ env.REGISTRY }} + run: echo "Ok" \ No newline at end of file diff --git a/.github/workflows/workflow-tester68.yml b/.github/workflows/workflow-tester68.yml new file mode 100644 index 0000000000..8d7a77b851 --- /dev/null +++ b/.github/workflows/workflow-tester68.yml @@ -0,0 +1,42 @@ +name: Test 68 # Related to https://stackoverflow.com/questions/74188647/add-variable-value-to-github-action-name + +on: + push: + workflow_dispatch: + +env: + DOTNET_VERSION: '6.0.401' # The .NET SDK version to use + +jobs: + build-and-test: + name: build-and-test-${{matrix.os}} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-20.04, ubuntu-22.04] + steps: + - uses: actions/checkout@v3 + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ env.DOTNET_VERSION }} + + # - name: Install dependencies + # run: dotnet restore + + # - name: Build + # run: dotnet build --configuration Release + + - name: Unit Test 1 + continue-on-error: true + run: dotnet --no-restore --verbosity normal + + - name: Extract exit Code + run: echo $? + + - name: Unit Test 2 + continue-on-error: true + run: + dotnet --no-restore --verbosity normal || true + echo "Check" + echo $? \ No newline at end of file diff --git a/.github/workflows/workflow-tester69.yml b/.github/workflows/workflow-tester69.yml new file mode 100644 index 0000000000..84aebd3ab4 --- /dev/null +++ b/.github/workflows/workflow-tester69.yml @@ -0,0 +1,30 @@ +name: Test 69 # Related to https://stackoverflow.com/questions/74188363/set-github-workflow-environment-variable-based-on-branch + +on: + push: + branches: + - main + - release/* + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${GITHUB_REPOSITORY}-image + TAG_PREXIX: ${GITHUB_REF##*/}-v + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Extract branch tag + id: version + run: | + BRANCH=${GITHUB_REF##*/} + VERSION="${BRANCH//release///""}" + echo $VERSION + + job2: + runs-on: ubuntu-latest + steps: + - run: | + echo ${{ env.IMAGE_NAME }} + echo ${{ env.TAG_PREXIX }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester70.yml b/.github/workflows/workflow-tester70.yml new file mode 100644 index 0000000000..c97146dc66 --- /dev/null +++ b/.github/workflows/workflow-tester70.yml @@ -0,0 +1,49 @@ +name: Test 70 # Related to https://stackoverflow.com/questions/74218808/create-a-json-map-using-bash?noredirect=1#comment131042179_74218808 + +on: + workflow_dispatch: + inputs: + python_versions: + description: "Python Versions" + required: false + default: "3.7" + +jobs: + job1: + runs-on: ubuntu-latest + outputs: + python_builds_full: ${{ steps.set-python-matrix.outputs.python_builds_full }} + python_builds_short: ${{ steps.set-python-matrix.outputs.python_builds_short }} + steps: + - name: get full python versions + id: set-python-matrix + env: + pversions: ${{ inputs.python_versions }} + shell: bash + run: | + OUT="" + for version in ${pversions//,/ } + do + docker pull python:${version}-buster + VER=$(docker inspect python:${version}-buster | jq '.[0].Config.Env' | grep PYTHON_VERSION | cut -d'=' -f2 | cut -d'"' -f 1) + OUT+="${VER}," + done + PYTHON_BUILDS=$(echo "\"${OUT::-1}\"" | jq -c 'split(",")') + echo "python_builds_full=${PYTHON_BUILDS}" >> $GITHUB_OUTPUT # save `major.minor` + + PYTHON_BUILDS_SHORT = $PYTHON_BUILDS # with expression to remove minor + echo "python_builds_short=${PYTHON_BUILDS_SHORT}" >> $GITHUB_OUTPUT # # `major.minor.patch` + + job2: + name: build the python images + needs: + - job1 + strategy: + matrix: + python-builds-full: ${{ fromJSON(needs.job1.outputs.python_builds_full) }} # `major.minor` + python-builds-short: ${{ fromJSON(needs.job2.outputs.python_builds_short) }} # `major.minor.patch` + fail-fast: true + uses: MyOrg/MyRepo/.github/workflows/reusable.yaml@master + with: + image_name: python-custom/${{ matrix.python-versions.python-builds-short }}} # <- here use `major.minor` + image_tag: ${{ matrix.python-versions.python-builds-full }}} # <- here use `major.minor.patch` \ No newline at end of file diff --git a/.github/workflows/workflow-tester71.yml b/.github/workflows/workflow-tester71.yml new file mode 100644 index 0000000000..c3387f60a7 --- /dev/null +++ b/.github/workflows/workflow-tester71.yml @@ -0,0 +1,22 @@ +name: Test 71 # Related to https://stackoverflow.com/questions/74252630/get-the-login-of-a-user-that-issued-a-comment-on-github-actions + +on: + issue_comment: + types: [created] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Dump GitHub context + env: + GITHUB_CONTEXT: ${{ toJSON(github) }} + run: echo "$GITHUB_CONTEXT" + + job2: + runs-on: ubuntu-latest + steps: + - run: | + echo ${{ github.actor }} + echo ${{ github.triggering_actor }} + echo ${{ github.event.comment.user.login }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester72.yml b/.github/workflows/workflow-tester72.yml new file mode 100644 index 0000000000..a60aae0aa1 --- /dev/null +++ b/.github/workflows/workflow-tester72.yml @@ -0,0 +1,43 @@ +name: Test 72 # Related to https://stackoverflow.com/questions/74386773/github-actions-job-is-skipped-although-all-needs-succeeded + +on: + push: + +jobs: + auto-versioning: + runs-on: ubuntu-latest + steps: + - run: echo 'auto-versioning' + + set-deployment-env: + runs-on: ubuntu-latest + steps: + - run: echo 'set-deployment-env' + + terraform-apply: + runs-on: ubuntu-latest + steps: + - run: echo 'terraform-apply' + + build-test-api: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/48-reusable-workflow-1.yml@main + needs: [set-deployment-env, auto-versioning] + if: | + always() && + (needs.set-deployment-env.result == 'success') && + (needs.auto-versioning.result == 'success' || needs.auto-versioning.result == 'skipped') + + debug-deploy-api: + runs-on: ubuntu-latest + needs: [build-test-api, terraform-apply, set-deployment-env] + if: always() # Had to add this, otherwise it would be skipped just as "deploy-api". + steps: + - run: | + echo "Result of auto-versioning: ${{ needs.auto-versioning.result }}" + echo "Result of build-test-api: ${{ needs.build-test-api.result }}" + echo "Result of terraform-apply: ${{ needs.terraform-apply.result }}" + echo "Result of set-deployment-env: ${{ needs.set-deployment-env.result }}" + + deploy-api: #always skipped + needs: [build-test-api, terraform-apply, set-deployment-env] + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/48-reusable-workflow-1.yml@main \ No newline at end of file diff --git a/.github/workflows/workflow-tester73.yml b/.github/workflows/workflow-tester73.yml new file mode 100644 index 0000000000..005382ec4f --- /dev/null +++ b/.github/workflows/workflow-tester73.yml @@ -0,0 +1,52 @@ +name: Test 73 # Related to https://stackoverflow.com/questions/74644525/how-to-run-a-reusable-workflow-conditionnaly + +on: + workflow_dispatch: + inputs: + skip: + type: boolean + description: skip the workflow or not + required: true + default: false + +jobs: + check: + runs-on: ubuntu-latest + steps: + - run: echo ${{ inputs.skip }} + + build1: + name: build1 + if: ${{ inputs.skip == 'false' }} + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester52-reusable.yml@main + with: + input_var: 'something' + another_input_var: 'something else' + secrets: inherit + + build2: + name: build2 + if: ${{ inputs.skip == false }} + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester52-reusable.yml@main + with: + input_var: 'something' + another_input_var: 'something else' + secrets: inherit + + build3: + name: build3 + if: ${{ ! inputs.skip }} + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester52-reusable.yml@main + with: + input_var: 'something' + another_input_var: 'something else' + secrets: inherit + + build4: + name: build4 + if: ${{ inputs.skip }} + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester52-reusable.yml@main + with: + input_var: 'something' + another_input_var: 'something else' + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/workflow-tester74.yml b/.github/workflows/workflow-tester74.yml new file mode 100644 index 0000000000..31c31522a9 --- /dev/null +++ b/.github/workflows/workflow-tester74.yml @@ -0,0 +1,76 @@ +name: Test 74 # Related to https://github.com/GuillaumeFalourd/formulas-github/issues/21 + +on: + push: + +jobs: + Test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Pip Install + shell: pwsh + run : | + pip install PyGithub + python -m pip install requests + - uses: jannekem/run-python-script-action@v1 + id: secret + env: + TOKEN: ${{ secrets.ACCESS_TOKEN }} + with: + script: | + #!/usr/bin/python3 + import requests + import json + from base64 import b64encode + from nacl import encoding, public + def run(token, owner, repository, secret_name, secret_value): + url_public_key = f"https://api.github.com/repos/{owner}/{repository}/actions/secrets/public-key" + authorization = f"token {token}" + headers = { + "Accept": "application/vnd.github.v3+json", + "Authorization" : authorization, + "X-GitHub-Api-Version": "2022-11-28", + } + r = requests.get( + url = url_public_key, + headers = headers + ) + if r.status_code == 200: + key_datas = r.json() + url_secret = f"https://api.github.com/repos/{owner}/{repository}/actions/secrets/{secret_name}" + data = {} + data["encrypted_value"] = encrypt(key_datas["key"], secret_value) + data["key_id"] = key_datas["key_id"] + json_data = json.dumps(data) + r = requests.put( + url = url_secret, + data = json_data, + headers = headers + ) + if r.status_code == 201 or r.status_code == 204: + print(r.status_code) + print(f"✅ Secret \033[36m{secret_name}\033[0m successfully added to {owner}'s \033[36m{repository}\033[0m repository") + else: + print("❌ Couldn't add the secret to the repository") + print (r.status_code, r.reason) + else: + print("❌ Couldn't get the repository public key") + print (r.status_code, r.reason) + def encrypt(public_key: str, secret_value: str) -> str: + """Encrypt a Unicode string using the public key.""" + public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) + sealed_box = public.SealedBox(public_key) + encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) + return b64encode(encrypted).decode("utf-8") + + run("${{ env.TOKEN }}", "GuillaumeFalourd", "poc-github-actions", "TEST_2", "MyNameIsGeovaniGeorgio") + + - name: TestShow + shell: bash + run: echo "Secret value:" ${{ secrets.TEST_2 }} | sed 's/./& /g' \ No newline at end of file diff --git a/.github/workflows/workflow-tester75.yml b/.github/workflows/workflow-tester75.yml new file mode 100644 index 0000000000..688083e2ef --- /dev/null +++ b/.github/workflows/workflow-tester75.yml @@ -0,0 +1,22 @@ +name: Test 75 # Related to https://stackoverflow.com/questions/75446952/github-workflows-changing-or-specifying-environment-variables-in-matrix-jobs + +on: + push: + +env: + MY_VAR: One + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - env: + MY_VAR: Two + - env: + MY_VAR: Three + steps: + - run: | + echo "$MY_VAR" # is equal to ${{ env.MY_VAR }} + echo ${{ matrix.env.MY_VAR }} diff --git a/.github/workflows/workflow-tester76.yml b/.github/workflows/workflow-tester76.yml new file mode 100644 index 0000000000..84cdced422 --- /dev/null +++ b/.github/workflows/workflow-tester76.yml @@ -0,0 +1,18 @@ +name: Test 76 # Related to https://stackoverflow.com/questions/75675348/can-i-use-github-secrets-in-my-npmrc-file-if-so-how/75675523#75675523 + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: cat ./.npmrc + - name: Replace values + shell: bash + env: + PAT: ${{ secrets.ACCESS_TOKEN }} + run: | + sed -i.back "s|MY_PAT_SECRET|${PAT}|g" ./.npmrc + - run: cat ./.npmrc \ No newline at end of file diff --git a/.github/workflows/workflow-tester77.yml b/.github/workflows/workflow-tester77.yml new file mode 100644 index 0000000000..a62af6a490 --- /dev/null +++ b/.github/workflows/workflow-tester77.yml @@ -0,0 +1,13 @@ +name: Test 77 # Related to https://stackoverflow.com/questions/75720251/setup-environment-to-use-variable-context-when-calling-a-reusable-workflow + +on: + workflow_dispatch: + +jobs: + build_deploy: + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester78.yml@main + with: + project-id: ${{ vars.PROJECT_ID }} + environment: other + cluster-name: ${{ vars.CLUSTER_NAME }} + region: ${{ vars.REGION }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester78.yml b/.github/workflows/workflow-tester78.yml new file mode 100644 index 0000000000..f0902fe999 --- /dev/null +++ b/.github/workflows/workflow-tester78.yml @@ -0,0 +1,48 @@ +name: Test 78 # Related to https://stackoverflow.com/questions/75720251/setup-environment-to-use-variable-context-when-calling-a-reusable-workflow + +on: + workflow_call: + # Map the workflow outputs to job outputs + inputs: + project-id: + required: true + type: string + environment: + required: true + type: string + cluster-name: + required: true + type: string + region: + required: true + type: string + +jobs: + test: + runs-on: ubuntu-latest + steps: + - run: | + echo "${{ inputs.project-id }}" + echo "${{ inputs.environment }}" + echo "${{ inputs.cluster-name }}" + echo "${{ inputs.region }}" + + test-env: + runs-on: ubuntu-latest + environment: + name: other + steps: + - run: | + echo "${{ vars.PROJECT_ID }}" + echo "${{ vars.CLUSTER_NAME }}" + echo "${{ vars.REGION }}" + + test-dynamic-env: + runs-on: ubuntu-latest + environment: + name: ${{ inputs.environment }} + steps: + - run: | + echo "${{ vars.PROJECT_ID }}" + echo "${{ vars.CLUSTER_NAME }}" + echo "${{ vars.REGION }}" \ No newline at end of file diff --git a/.github/workflows/workflow-tester79.yml b/.github/workflows/workflow-tester79.yml new file mode 100644 index 0000000000..7ae928d163 --- /dev/null +++ b/.github/workflows/workflow-tester79.yml @@ -0,0 +1,31 @@ +name: Test 79 # Related to https://stackoverflow.com/questions/76018154/github-action-share-token-between-jobs-to-reuse + +on: + workflow_dispatch: + +jobs: + validate: + runs-on: ubuntu-latest + name: terraform validate + outputs: + installation_token: ${{ steps.get_installation_token.outputs.token }} + test_var: "Hello" + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Generate token + id: get_installation_token + run: | + TOKEN=TEST + echo "token=$TOKEN" >> $GITHUB_OUTPUT + + plan: + needs: + - validate + runs-on: ubuntu-latest + name: terraform plan + steps: + - name: Checkout + uses: actions/checkout@v3 + - run: echo "${{ needs.validate.outputs.installation_token }}" + - run: echo "${{ needs.validate.outputs.test_var }}" diff --git a/.github/workflows/workflow-tester8.yml b/.github/workflows/workflow-tester8.yml index 12bd12fa8b..5c864eb682 100644 --- a/.github/workflows/workflow-tester8.yml +++ b/.github/workflows/workflow-tester8.yml @@ -31,3 +31,38 @@ jobs: if: contains( needs.job1.outputs.tag_version , 'prod-') steps: - run: echo "${{needs.job1.outputs.tag_version}}" + + job4: + runs-on: ubuntu-latest + outputs: + tag_version: ${{ steps.get_tag_version.outputs.version }} + steps: + - name: Get the version + id: get_tag_version + run: echo "version=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + + job5: + runs-on: ubuntu-latest + needs: [job4] + if: contains( needs.job4.outputs.tag_version , 'dev-') + steps: + - run: echo "${{needs.job4.outputs.tag_version}}" + + job6: + runs-on: ubuntu-latest + needs: [job4] + if: contains( needs.job4.outputs.tag_version , 'prod-') + steps: + - run: echo "${{needs.job4.outputs.tag_version}}" + + job7: + runs-on: ubuntu-latest + steps: + - name: Extract branch tag + id: version + run: | + BRANCH=${GITHUB_REF##*/} + VERSION="123" + echo $VERSION + echo "tag=$VERSION" >> $GITHUB_OUTPUT + - run: echo ${{ steps.version.outputs.tag }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester80.yml b/.github/workflows/workflow-tester80.yml new file mode 100644 index 0000000000..1503942e07 --- /dev/null +++ b/.github/workflows/workflow-tester80.yml @@ -0,0 +1,39 @@ +name: Test 80 # Related to https://stackoverflow.com/questions/76307553/github-actions-failing-on-dependencies +on: + workflow_dispatch: + +env: + PYTHON_VERSION: '3.10' # set this to the python version to use (supports 3.6, 3.7, 3.8) + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Python version + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + + - name: Create and start virtual environment + run: | + python -m venv venv + source venv/bin/activate + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Execute Python script # Run the run.py to get the latest data + run: python run.py + + # Optional: Add step to run tests here + + - name: Upload artifact for deployment job + uses: actions/upload-artifact@v4.4.0 + with: + name: python-app + path: | + . + !venv/ \ No newline at end of file diff --git a/.github/workflows/workflow-tester81.yml b/.github/workflows/workflow-tester81.yml new file mode 100644 index 0000000000..a95c4b1c52 --- /dev/null +++ b/.github/workflows/workflow-tester81.yml @@ -0,0 +1,30 @@ +name: Test 81 # Related to https://stackoverflow.com/questions/76313404/how-to-replace-hard-coded-value-with-dynamic-input-variable-in-the-outputs-git + +on: + workflow_dispatch: + inputs: + key_name: + required: true + default: 'app_name' + +jobs: + mainjob1: + runs-on: "ubuntu-latest" + outputs: + app_namexx: ${{ steps.run-script.outputs.inputs.key_name }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - id: run-script + run: echo "${{inputs.key_name}}=test" >> $GITHUB_OUTPUT + - run: | + echo "App name as expected: ${{ steps.run-script.outputs.inputs.key_name }}" + echo "App name hardcoded: ${{ steps.run-script.outputs.app_name }}" + + test: + runs-on: "ubuntu-latest" + needs: mainjob1 + steps: + - run: | + echo "App name: ${{ needs.mainjob1.outputs.app_namexx }}" + diff --git a/.github/workflows/workflow-tester82.yml b/.github/workflows/workflow-tester82.yml new file mode 100644 index 0000000000..a4d8e8a96a --- /dev/null +++ b/.github/workflows/workflow-tester82.yml @@ -0,0 +1,35 @@ +name: Test 82 # Related to SO question https://stackoverflow.com/questions/76370265/how-to-interpolate-workflow-level-variable-into-another-workflow-level-variable + +on: + workflow_dispatch: + +env: + APPNAME: 'myapp1' + APPURL: "https://mybank/$APPNAME/widgets/hello.json" + +jobs: + run: + runs-on: ubuntu-latest + steps: + - name: Check APPURL value + run: | + echo "APPURL is: ${{env.APPURL}}" # Will return "https://mybank/myapp1/widgets/hello.json" + + - name: Concatenate values to environment file + run: | + echo "URL=https://mybank/${{ env.APPNAME }}/widgets/hello.json" >> $GITHUB_ENV + + - name: Check environment variable is available + run: | + echo "${{ env.URL }}" # Will return https://mybank/myapp1/widgets/hello.json + + test: + runs-on: windows-latest + steps: + - name: Print variables (Powershell) + run: | + echo "APPURL is: ${{ env.APPURL }}" # Will return https://mybank//widgets/hello.json + - name: Print variables (Bash) + run: | + echo "APPURL is: ${{ env.APPURL }}" # Will return https://mybank/myapp1/widgets/hello.json + shell: bash diff --git a/.github/workflows/workflow-tester83.yml b/.github/workflows/workflow-tester83.yml new file mode 100644 index 0000000000..a0e9df3774 --- /dev/null +++ b/.github/workflows/workflow-tester83.yml @@ -0,0 +1,23 @@ +name: Test 83 # Related to SO question https://stackoverflow.com/questions/76372158/in-github-action-can-i-set-a-condition-to-initialize-a-step-input + +on: + workflow_dispatch: + inputs: + my-input-dispatch: + description: 'Test input' + required: false + default: '' + +env: + my-input: ${{ inputs.my-input-dispatch != '' && inputs.my-input-dispatch }} + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: echo ${{ env.my-input }} + - name: Test gh action 5 + uses: ./.github/workflows/test-action + with: + my-input-with-default: ${{ env.my-input }} diff --git a/.github/workflows/workflow-tester84.yml b/.github/workflows/workflow-tester84.yml new file mode 100644 index 0000000000..ff6a847d98 --- /dev/null +++ b/.github/workflows/workflow-tester84.yml @@ -0,0 +1,44 @@ +name: Test 84 # Related to SO question https://stackoverflow.com/questions/76588045/github-workflow-confused-about-tojson-and-fromjson-im-doing-a-json-ouput-and + +on: + workflow_dispatch: + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + versions: ${{ steps.array.outputs.array }} + steps: + - id: array + run: | + myArray=() + if [ "true" = "true" ] # some condition + then + myArray+=("7.4.10") + fi + if [ "true" = "true" ] # some condition + then + myArray+=("5.6.13") + fi + if [ "true" = "true" ] # some condition + then + myArray+=("7.4.33") + fi + if [ "true" = "true" ] # some condition + then + myArray+=("8.1") + fi + myArray=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${myArray[@]}") + echo "Updated array list: $myArray" + echo "array=$myArray" >> $GITHUB_OUTPUT + shell: bash + + build: + runs-on: ubuntu-latest + needs: [setup] + strategy: + fail-fast: false + matrix: + version: ${{ fromJSON(needs.setup.outputs.versions) }} + steps: + - run: echo ${{ matrix.version }} diff --git a/.github/workflows/workflow-tester85.yml b/.github/workflows/workflow-tester85.yml new file mode 100644 index 0000000000..cad541292b --- /dev/null +++ b/.github/workflows/workflow-tester85.yml @@ -0,0 +1,29 @@ +name: Test 85 # Related to https://stackoverflow.com/questions/76925353/invalid-syntax-on-github-output?noredirect=1#comment135621975_76925353 + +on: + push: + workflow_dispatch: + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Checkout repository content + uses: actions/checkout@v3 # Checkout the repository content to github runner. + + - name: Setup Python Version + uses: actions/setup-python@v2 + with: + python-version: 3.8 # Install the python version needed + + - name: Execute Python script # Run the run.py to get the latest data + id: test1 + run: python scripts/list-output.py + + - name: Check output + run: | + echo ${{steps.test1.outputs.test}} + + - name: Check env + run: | + echo ${{env.TEST}} \ No newline at end of file diff --git a/.github/workflows/workflow-tester86.yml b/.github/workflows/workflow-tester86.yml new file mode 100644 index 0000000000..91c2c5346a --- /dev/null +++ b/.github/workflows/workflow-tester86.yml @@ -0,0 +1,40 @@ +name: Test 86 # Related to https://stackoverflow.com/questions/77043578/using-array-from-a-job-as-matrix-in-another-job?noredirect=1#comment135819303_77043578 + +on: + push: + workflow_dispatch: + +jobs: + identify-changes: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.extract.outputs.matrix }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Extract Dockerfile paths + id: extract + run: | + json_array_str="['directory1/Dockerfile','directory2/Dockerfile']" + + # Save JSON array to output + echo "matrix=$json_array_str" >> $GITHUB_OUTPUT + echo $json_array_str + + build: + runs-on: ubuntu-latest + needs: identify-changes + continue-on-error : true + + strategy: + matrix: + dockerfile: ${{ fromJSON(needs.identify-changes.outputs.matrix) }} + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Echo Docker images + run: | + echo ${{ matrix.dockerfile }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester87.yml b/.github/workflows/workflow-tester87.yml new file mode 100644 index 0000000000..b66fb865d0 --- /dev/null +++ b/.github/workflows/workflow-tester87.yml @@ -0,0 +1,23 @@ +name: Test 87 + +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: StackSpot Runtime Infra Debian (v1) + runs-on: ubuntu-latest + steps: + - name: Show STK CLI version (1) + run: | + docker run -t --entrypoint /bin/bash -v $(pwd):/data stackspot/stk-cli-debian:5.4.7 -c ' + cd /data + ~/.stk/bin/stk -v + ' + env: + HTTP_ENABLE_DEBUG: true diff --git a/.github/workflows/workflow-tester88-reusable.yml b/.github/workflows/workflow-tester88-reusable.yml new file mode 100644 index 0000000000..b57add6eb3 --- /dev/null +++ b/.github/workflows/workflow-tester88-reusable.yml @@ -0,0 +1,30 @@ +name: Test 88 (reusable) + +on: + workflow_call: + inputs: + stage: + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Build in ${{ inputs.stage }} + run: | + echo "Build in ${{ inputs.stage }}" + + test: + runs-on: ubuntu-latest + steps: + - name: Test in ${{ inputs.stage }} + run: | + echo "Test in ${{ inputs.stage }}" + + deploy: + runs-on: ubuntu-latest + steps: + - name: Deploy in ${{ inputs.stage }} + run: | + echo "Deploy in ${{ inputs.stage }}" \ No newline at end of file diff --git a/.github/workflows/workflow-tester88.yml b/.github/workflows/workflow-tester88.yml new file mode 100644 index 0000000000..102a69fc57 --- /dev/null +++ b/.github/workflows/workflow-tester88.yml @@ -0,0 +1,47 @@ +name: Test 88 # Related to SO: https://stackoverflow.com/questions/72537896/github-actions-create-matrix-of-multiple-sequential-jobs + +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + common-matrix-job: + runs-on: ubuntu-latest + outputs: + environments: ${{ steps.environments.outputs.environments }} + steps: + - name: Build Environments Array + id: environments + run: | + myArray=() + myArray+=("env1") + myArray+=("env2") + myArray+=("env3") + myArray=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${myArray[@]}") + echo "Updated environments list: $myArray" + echo "environments=$myArray" >> $GITHUB_OUTPUT + shell: bash + + reusable: + needs: [common-matrix-job] + strategy: + matrix: + environment: ${{ fromJSON(needs.common-matrix-job.outputs.environments) }} + fail-fast: true + max-parallel: 1 + # environment: + # name: ${{ matrix.environment }} + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester88-reusable.yml@main + with: + stage: ${{ matrix.environment }} + + common-job: + needs: [common-matrix-job, reusable] + runs-on: ubuntu-latest + steps: + - name: Do something + run: echo "Do something" \ No newline at end of file diff --git a/.github/workflows/workflow-tester89.yml b/.github/workflows/workflow-tester89.yml new file mode 100644 index 0000000000..8092fddee5 --- /dev/null +++ b/.github/workflows/workflow-tester89.yml @@ -0,0 +1,28 @@ +name: Test 89 # Related to SO: https://stackoverflow.com/questions/77133952/reusable-workflows-should-be-referenced-at-the-top-level-jobs-uses-key-not +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + bd_scan: + runs-on: ubuntu-latest + outputs: + day: ${{ steps.check_day.outputs.day }} + steps: + - name: Check Day of the Week + id: check_day + run: | + echo $(date +%u) + echo "day=$(date +%u)" >> $GITHUB_OUTPUT + + reusable: + needs: [bd_scan] + if: ${{ needs.bd_scan.outputs.day < 5 }} + uses: GuillaumeFalourd/poc-github-actions/.github/workflows/workflow-tester88-reusable.yml@main + with: + stage: ${{ needs.bd_scan.outputs.day }} + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/workflow-tester9.yml b/.github/workflows/workflow-tester9.yml index 271359cdcc..d3904c931c 100644 --- a/.github/workflows/workflow-tester9.yml +++ b/.github/workflows/workflow-tester9.yml @@ -1,6 +1,6 @@ name: Test 9 -on: [push, workflow_dispatch] +on: [workflow_dispatch] jobs: test1: diff --git a/.github/workflows/workflow-tester90.yml b/.github/workflows/workflow-tester90.yml new file mode 100644 index 0000000000..290dc85aaf --- /dev/null +++ b/.github/workflows/workflow-tester90.yml @@ -0,0 +1,30 @@ +name: Test 90 # Related to SO: https://stackoverflow.com/questions/78233438/github-action-cannot-get-timeout-status-from-previous-step +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Run Spectacles Job + id: spectaclesJob + timeout-minutes: 1 + continue-on-error: true + run: | + echo "Waiting 1 minute 30 seconds..." + sleep 90 + + - name: Print conclusion + run: echo ${{ steps.spectaclesJob.conclusion }} + + - name: Print outcome + run: echo ${{ steps.spectaclesJob.outcome }} + + - name: Why does this step not run + if: ${{ steps.spectaclesJob.conclusion == 'timeout' }} + run: echo "And why is the conclusion 'success'" \ No newline at end of file diff --git a/.github/workflows/workflow-tester91.yml b/.github/workflows/workflow-tester91.yml new file mode 100644 index 0000000000..c05ed8949f --- /dev/null +++ b/.github/workflows/workflow-tester91.yml @@ -0,0 +1,24 @@ +name: Test 91 +on: + push: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: windows-latest + steps: + - name: Clone GuillaumeFalourd/formulas-training PRIVATE repository + uses: GuillaumeFalourd/clone-github-repo-action@v2.3 + with: + owner: 'GuillaumeFalourd' + repository: 'formulas-training' + access-token: ${{ secrets.ACCESS_TOKEN }} + + - name: Access cloned repository content + run: | + Set-Location formulas-training + Get-ChildItem -Force diff --git a/.github/workflows/workflow-tester92.yml b/.github/workflows/workflow-tester92.yml new file mode 100644 index 0000000000..0d9e7d16d6 --- /dev/null +++ b/.github/workflows/workflow-tester92.yml @@ -0,0 +1,29 @@ +name: Test 92 # Related to SO https://stackoverflow.com/questions/78257809/github-action-contains-conditional-issue + +on: + workflow_dispatch: + +jobs: + test: + runs-on: windows-latest + steps: + - name: Build 1 + id: Build1 + run: echo Build + continue-on-error: true + - name: Build 2 + id: Build2 + run: exit1 + continue-on-error: true + - name: Check Build1 - 1 + if: contains(steps.Build1.outcome, 'success') + run: echo ${{steps.Build1.outcome}} + - name: Check Build1 - 2 + if: steps.Build1.outcome == 'success' + run: echo ${{steps.Build1.outcome}} + - name: Check Build2 - 1 + if: contains(steps.Build2.outcome, 'failure') + run: echo ${{steps.Build2.outcome}} + - name: Check Build2 - 2 + if: steps.Build2.outcome != 'success' + run: echo ${{steps.Build2.outcome}} diff --git a/.github/workflows/workflow-tester93.yml b/.github/workflows/workflow-tester93.yml new file mode 100644 index 0000000000..b491a65b95 --- /dev/null +++ b/.github/workflows/workflow-tester93.yml @@ -0,0 +1,27 @@ +name: Test 93 # Related to SO https://stackoverflow.com/questions/78337398/github-default-working-directory-with-variable + +on: + workflow_dispatch: + inputs: + ENVIRONMENT: + default: development + type: string + PATH: + default: test + type: string + +env: + PATH: ${{ inputs.PATH }} + +jobs: + job1: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + working-directory: ${{ env.PATH }} + steps: + - name: Run Commands with various variables + run: | + echo "Hello World" + echo "${{ inputs.ENVIRONMENT}}/${{ inputs.PATH }} " \ No newline at end of file diff --git a/.github/workflows/workflow-tester94.yml b/.github/workflows/workflow-tester94.yml new file mode 100644 index 0000000000..051555e965 --- /dev/null +++ b/.github/workflows/workflow-tester94.yml @@ -0,0 +1,23 @@ +name: Test 94 # Related to SO https://stackoverflow.com/questions/78401891/modify-the-run-name-into-uppercase-of-workflow-github-actions?noredirect=1#comment138222651_78401891 + +on: + workflow_dispatch: + inputs: + environment: + required: true + type: choice + description: Select the environment + options: + - 'dev' + - 'test' + - 'prod' + default : 'dev' + +run-name: Trial - ${{ inputs.environment == 'dev' && 'DEV' || inputs.environment == 'test' && 'TEST' || 'PROD' }} + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Dummy workflow + run: echo "dummy workflow" \ No newline at end of file diff --git a/.github/workflows/workflow-tester95.yml b/.github/workflows/workflow-tester95.yml new file mode 100644 index 0000000000..cc4ce66e54 --- /dev/null +++ b/.github/workflows/workflow-tester95.yml @@ -0,0 +1,50 @@ +name: Test 95 # Related to SO https://stackoverflow.com/questions/78461104/how-can-i-configure-a-github-actions-strategy-matrix-to-dynamically-read-a-json + +on: + workflow_dispatch: + inputs: + stsReplay: + description: 'team to pick' + required: true + default: 'real-madrid' + type: choice + options: + - 'manu' + - 'chelsea' + - 'real-madrid' + - 'fc-barcelona' + - 'bayern' + - 'ac-milan' + +env: + REPLAY_MAP_JSON: | + { + "manu": ["casemiro","dalot","rashford"], + "chelsea": ["sterling","james","silva"], + "real-madrid": ["vini-jr","modric","kroos"], + "bayern": ["sane","kane","alphonso"], + "ac-milan": ["rafael-leao","giroud","pulisic"] + } + +jobs: + job1: + runs-on: ubuntu-latest + outputs: + players: ${{ steps.set-matrix.outputs.values }} + steps: + - id: set-matrix + run: | + input_replay="real-madrid" + echo "input_replay: $input_replay" + values=$(echo "${REPLAY_MAP_JSON}" | jq -r --arg input_replay "$input_replay" '.[$input_replay] | map("\"\(.)\"") | join(", ")') + echo "values:[$values]" + echo "values=[$values]" >> $GITHUB_OUTPUT + + job2: + needs: job1 + runs-on: ubuntu-latest + strategy: + matrix: + players: ${{fromJson(needs.job1.outputs.players)}} + steps: + - run: echo "Player ${{ matrix.players}}" diff --git a/.github/workflows/workflow-tester96.yml b/.github/workflows/workflow-tester96.yml new file mode 100644 index 0000000000..e12a5686a0 --- /dev/null +++ b/.github/workflows/workflow-tester96.yml @@ -0,0 +1,25 @@ +name: Test 96 # Related to SO https://stackoverflow.com/questions/78512402/how-to-reuse-script-from-jenkins-in-github-actions?noredirect=1#comment138415710_78512402 + +on: + workflow_dispatch: + +jobs: + build: + runs-on: [ubuntu-latest] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: List files (Start) + run: | + ls + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'adopt' + - name: Install Groovy + run: sudo apt-get update && sudo apt-get install -y groovy + - name: Run Groovy script + run: | + ls -lha + groovy script.groovy \ No newline at end of file diff --git a/.github/workflows/workflow-tester97.yml b/.github/workflows/workflow-tester97.yml new file mode 100644 index 0000000000..c39b9b9232 --- /dev/null +++ b/.github/workflows/workflow-tester97.yml @@ -0,0 +1,16 @@ +name: Test 97 # Related to SO https://stackoverflow.com/questions/78514157/can-we-put-if-else-condition-on-runs-on-for-the-choice-of-workflow-runner?noredirect=1#comment138418481_78514157 + +on: + workflow_dispatch: + +jobs: + test: + runs-on: ${{ matrix.object.envRunner }} + strategy: + matrix: + object: [{"envName":"dev", "envRunner":"ubuntu-latest"}, {"envName":"stg", "envRunner":"windows-latest"}, {"envName":"prd", "envRunner":"macos-latest"}] + fail-fast: true + max-parallel: 1 + steps: + - run: | + echo ${{ matrix.object.envName }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester98-reusable.yml b/.github/workflows/workflow-tester98-reusable.yml new file mode 100644 index 0000000000..5d21b16e8e --- /dev/null +++ b/.github/workflows/workflow-tester98-reusable.yml @@ -0,0 +1,37 @@ +name: Test 98 reusable # Related to SO https://stackoverflow.com/questions/78513070/how-to-send-variables-to-called-workflow-from-the-caller-workflow/78514014?noredirect=1#comment138421206_78514014 + +on: + workflow_dispatch: + inputs: + cacheName: + type: string + description: 'Provide Cache Name' + expirationType: + type: string + description: 'Provide Expiration Type' + expirationTime: + type: string + description: 'Provide Expiration Time in Seconds' + + workflow_call: + inputs: + cacheName: + type: string + description: 'Provide Cache Name' + expirationType: + type: string + description: 'Provide Expiration Type' + expirationTime: + type: string + description: 'Provide Expiration Time in Seconds' + +jobs: + Create_Update-Cache: + runs-on: [ubuntu-latest] + steps: + - name: Do something + run: | + echo Iteration + echo ${{ inputs.cacheName }} + echo ${{ inputs.expirationType }} + echo ${{ inputs.expirationTime }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester98.yml b/.github/workflows/workflow-tester98.yml new file mode 100644 index 0000000000..2ff7075dc2 --- /dev/null +++ b/.github/workflows/workflow-tester98.yml @@ -0,0 +1,55 @@ +name: Test 98 # Related to SO https://stackoverflow.com/questions/78513070/how-to-send-variables-to-called-workflow-from-the-caller-workflow/78514014?noredirect=1#comment138421206_78514014 + +on: + workflow_dispatch: + +jobs: + build: + runs-on: [ubuntu-latest] + outputs: + iterations: ${{ steps.set-iterations.outputs.values }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Read CSV and trigger workflows + id: set-iterations + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo Saving iteration list output as Array + # Join the array elements into a single JSON array + json_array='[{"cacheName":"iteration1","expirationType":"iteration1","expirationTime":"iteration1"}, {"cacheName":"iteration2","expirationType":"iteration2","expirationTime":"iteration2"}, {"cacheName":"iteration3","expirationType":"iteration3","expirationTime":"iteration3"}]' + echo "List: $json_array" + echo "values=$json_array" >> $GITHUB_OUTPUT + - name: Check list + run: | + echo ${{ steps.set-iterations.outputs.values }} + + call-ASGW-Config-Cache: + needs: [build] + strategy: + matrix: + iteration: ${{fromJson(needs.build.outputs.iterations)}} + uses: ./.github/workflows/workflow-tester98-reusable.yml + secrets: inherit + permissions: + contents: read + with: + cacheName: ${{ matrix.iteration.cacheName }} + expirationType: ${{ matrix.iteration.expirationType }} + expirationTime: ${{ matrix.iteration.expirationTime }} + + check: + needs: [build] + runs-on: [ubuntu-latest] + strategy: + matrix: + iteration: ${{fromJson(needs.build.outputs.iterations)}} + steps: + - name: Do something + run: | + echo Iteration + echo ${{ matrix.iteration }} + echo ${{ matrix.iteration.cacheName }} + echo ${{ matrix.iteration.expirationType }} + echo ${{ matrix.iteration.expirationType }} \ No newline at end of file diff --git a/.github/workflows/workflow-tester99.yml b/.github/workflows/workflow-tester99.yml new file mode 100644 index 0000000000..25a59cf984 --- /dev/null +++ b/.github/workflows/workflow-tester99.yml @@ -0,0 +1,20 @@ +name: Test 99 # https://stackoverflow.com/questions/78875784/github-action-stage-not-triggering-if-previous-stage-failed + +on: + workflow_dispatch: + +jobs: + some-test: + runs-on: ubuntu-latest + steps: + - name: Force job failure + run: exit 1 + + some-test-rerun: + needs: [some-test] + runs-on: ubuntu-latest + if: always() && needs.some-test.result == 'failure' + steps: + - name: Retry + run: | + echo "retry" diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000000..87faa15834 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +authToken=MY_PAT_SECRET \ No newline at end of file diff --git a/Config.json b/Config.json new file mode 100644 index 0000000000..2c38ad683a --- /dev/null +++ b/Config.json @@ -0,0 +1,29 @@ +{ + "bundles": + [ + { + "product":{ + "name" : "Product1", + "proxies" : ["'Proxy1', 'Proxy2'"], + "attributes" : [{"name":"Test1","value":"abc"}] + }, + "app":{ + "name":"App1", + "attributes": [{"name": "attribute1","value": "null"}], + "developer": "rohit@example.com" + } + }, + { + "product":{ + "name" : "Product2", + "proxies" : ["'Proxy1', 'Proxy2'"], + "attributes" : [{"name":"Test2","value":"xyz"}] + }, + "app":{ + "name":"App1", + "attributes": [{"name": "attribute2","value": "null"}], + "developer": "guifalourd@example.com" + } + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md index b338042567..373b9d26a0 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,22 @@ ![title](/docs/github-actions.png) -This repository is a Github Actions POC with various examples regarding how to create workflows 🤖 +This repository contains various proofs of concept using a Github Actions through workflows 🤖 ## Contents 🇧🇷 - [Introdução ao Github Actions](https://www.zup.com.br/blog/github-actions-ci-cd) - [Como executar um script usando GitHub Actions](https://www.zup.com.br/blog/executar-script-github-actions) - [Github Actions – variáveis de ambiente e secrets](https://www.zup.com.br/blog/github-actions-variaveis-de-ambiente-e-secrets) +- [Como manipular outputs no GitHub Actions](https://www.zup.com.br/blog/manipular-outputs-github-actions) +- [Workflows no GitHub Actions: como usar events e triggers](https://www.zup.com.br/blog/workflows-no-github-actions) +- [Como manipular outputs no GitHub Actions](https://www.zup.com.br/blog/manipular-outputs-github-actions) +- [Como usar imagens do Docker com workflows no Github Actions](https://www.zup.com.br/blog/github-actions-docker) +- [Como gerenciar artefatos nos workflows do Github Actions](https://www.zup.com.br/blog/artefatos-github-actions) +- [Como usar condicionais nos workflows do Github Actions ](https://www.zup.com.br/blog/como-usar-condicionais-workflows-github-actions) +- [10 boas práticas e dicas para usar o GitHub Actions](https://www.zup.com.br/blog/github-actions-dicas-boas-praticas) +- [Quando usar Reusable Workflow ou Composite Action no GitHub Actions?](https://www.zup.com.br/blog/reusable-workflow-e-composite-action) +- [Git Flow customizado no Github Actions](https://www.zup.com.br/blog/git-flow) ## Workflow YAML Basic Structure Explanation @@ -19,7 +28,7 @@ on: push: # Run this workflow every time a new commit pushed to the repository pull_request: # Run this workflow every time a new pull request is opened to the repository scheduled: # Run this workflow as a cron job - - cron: "0 0 * * *" + - cron: "0 0 * * MON-FRI" workflow_dispatch: # Run this workflow on demand (manually) jobs: # All workflows need at list one job @@ -85,7 +94,7 @@ This workflow illustrates how to pass data between jobs in the same workflow. Fo [![10 - Environment workflow](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/10-environment-workflow.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/10-environment-workflow.yml) -This workflow illustrates how to use `environment` variables from the whole workflow, a specific job, or a specific step. +This workflow illustrates how to use `environment` variables from the whole workflow, a specific job, or a specific step, as well as for an environment secret. [![11 - Input workflow](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/11-input-workflow.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/11-input-workflow.yml) @@ -159,3 +168,169 @@ This workflow illustrates how to use outputs between jobs with the `needs` conte [![28 - Create Pull Request (Workflow)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/28-create-pull-request.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/28-create-pull-request.yml) This workflow illustrates how to create a new Pull Request based on a branch name after a push event. + +[![29 - Check Actor on PR or PUSH](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/29-check-actor-pr-or-push.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/29-check-actor-pr-or-push.yml) + +This workflow illustrates how to add a comment on a new Pull Request based on the github actor name after a PR event. + +[![30 - Webhook Release](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/30-webhook-release.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/30-webhook-release.yml) - DEPRECATED + +This workflow illustrates how to call a webhook on each release extracting the release tag. + +[![31 - Untouchable file](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/31-untouchable-file.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/31-untouchable-file.yml) + +This workflow illustrates how to close a Pull Request automatically if it updates on file that shouldn't be modified. + +[![32 - PR approved and labeled](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/32-pr-approved-and-labeled.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/32-pr-approved-and-labeled.yml) + +This workflow illustrates how to perform a specific action when approving a Pull request if it contains a specific label. + +[![33 - Reusable workflow](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/33-reusable-workflow.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/33-reusable-workflow.yml) + +This workflow illustrates how to implement a [reusable workflow](https://docs.github.com/en/actions/learn-github-actions/reusing-workflows). + +[![34 - Workflow Call](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/34-workflow-call.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/34-workflow-call.yml) + +This workflow illustrates how to use and call a reusable workflow (cf workflow 33 above). + +[![35 - Github Config](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/35-github-config.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/35-github-config.yml) + +This workflow illustrates how to extract and use the user email and username from the commit using github config log commands. + +[![36 - Local Action](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/36-local-action.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/36-local-action.yml) + +This workflow illustrates how to use a `local action` file in one (or multiple workflows) and extract its outputs to perform other operations. + +[![37 - Continue On Error Matrix](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/37-continue-on-error-matrix.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/37-continue-on-error-matrix.yml) + +This workflow illustrates how to use matrix as well as expressions with `continue-on-error` and `if` conditionnal fields. + +[![38 - Get PR number from PUSH event](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/38-get-pr-number-on-push-event.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/38-get-pr-number-on-push-event.yml) + +This workflow illustrates how to get the related PR number to a push event. + +[PR event](https://github.com/GuillaumeFalourd/poc-github-actions/runs/4317001308?check_suite_focus=true) and [Related PUSH event](https://github.com/GuillaumeFalourd/poc-github-actions/runs/4317001027?check_suite_focus=true) + +[![39 - Extract From Branch](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/39-extract-from-branch.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/39-extract-from-branch.yml) [![40 - Invoked Workflow Dispatch](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/40-invoked-workflow-dispatch.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/40-invoked-workflow-dispatch.yml) + +This workflows illustrate how to extract the tag version when a specific branch is created (e.g: `release-1.2.3`), and how to invoke another workflow through a disptach event sending this tag as input. + +[![41 - Commit other repo](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/41-commit-other-repo.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/41-commit-other-repo.yml) + +This workflow illustrates how to commit files from the current repo to another repo. + +[![43 - Not trigger on tag](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/43-not-trigger-on-tag.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/43-not-trigger-on-tag.yml) + +This workflow illustrates how to trigger a workflow on different event but NOT on tag. + +[![44 - Check if PR from Fork](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/44-check-if-pr-from-fork.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/44-check-if-pr-from-fork.yml) + +This workflow illustrates how to check if a PR is opened from a FORK repository or not. + +[![45 - Get all yaml files](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/45-get-all-yaml-files.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/45-get-all-yaml-files.yml) + +This workflow illustrates how to list all files from a specific extension (here, `.yaml` or `.yml`). + +[![46 - Print env](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/46-print-env.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/46-print-env.yml) + +This workflow illustrates how to list all env variables set in the runner. + +[![47 - Force Failure](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/47-force-failure.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/47-force-failure.yml) - AS EXPECTED + +This workflow illustrates how to force a workflow failure if a condition isn't met. + +[![48 - Wait for reusable completion](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/48-wait-for-reusable-completion.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/48-wait-for-reusable-completion.yml) - DEPRECATED + +This workflow illustrates how to wait for other workflows completion before executing some operation (using reusable workflows). + +[![49 - Rename on release](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/49-rename-on-release.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/49-rename-on-release.yml) + +This workflow illustrates how to rename a file according to the `github ref name` (branch or tag name). + +[![50 - Create tag](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/50-create-tag.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/50-create-tag.yml) + +This workflow illustrates how to simply create a tag in a job. + +[![51 - Concurrency](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/51-concurrency.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/51-concurrency.yml) + +This workflow illustrates how to use concurrency to avoid the same workflow to run in parallel for different push to the same branch (for example to limit Github actions runner usage in private repo). + +[![52 - Print Secret](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/52-print-secret.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/52-print-secret.yml) + +This workflow illustrates how to print secrets values on a workflow run. To harden the security of your github actions, have a look at [this guide](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions) on the Github Official Documentation. + +[![53 - Concatenation](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/53-concatenation.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/53-concatenation.yml) + +This workflow illustrates how to concatenate `env` variables using the environment file. + +[![54 - Permissiom](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/54-permission.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/54-permission.yml) + +This workflow illustrates how to use the `permission` field at the workflow level. Giving the GITHUB_TOKEN a specific permission scope during the workflow execution. + +[![55 - Create Issue](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/55-create-issue.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/55-create-issue.yml) [![55 - Read Issue](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/55-read-issue.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/55-read-issue.yml) + +These workflows illustrate how to **create** and **read** an issue body variable according to a specific [issue template](https://github.com/GuillaumeFalourd/poc-github-actions/blob/main/.github/ISSUE_TEMPLATE_DEPLOYMENT.md). + +[![57 - Reusable outputs](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/57-reusable-outputs.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/57-reusable-outputs.yml) + +This workflow illustrates how to use **outputs** with reusable workflows. + +[![58 - Env Expressions](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/58-env-expressions.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/58-env-expressions.yml) + +This workflows illustrates how to use **expressions** when setting env variables ath the workflow level, according to the trigger event. + +[![59 - Step Context](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/59-step-context.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/59-step-context.yml) + +This workflows illustrates how to use **[step context](https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context)**, which contains detail about the execution of each step by default. Using the `outcome` property of each step we can check the result of its execution. + +[![60 - Save secrets variables](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/60-save-secrets-variables.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/60-save-secrets-variables.yml) + +This workflow illustrates how to save secrets in artifacts to use on later jobs. + +[![61 - Create Tag and Release](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/61-create-tag-and-release.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/61-create-tag-and-release.yml) [![62 - Create Trigger on release other workflow](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/62-trigger-on-release-other-workflow.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/62-trigger-on-release-other-workflow.yml) + +Those workflows illustrate how to **trigger a release creation** (with tag based on a branch syntax) where the release publication could **trigger a deployment pipeline**. + +[![63 - Matrix folder](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/63-matrix-folder.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/63-matrix-folder.yml) + +This workflow illustrates how to identify updated folders to perfom a similar behavior based on the folder through a reusable workflow with a matrix strategy. + +[![65 - Sequential Matrix](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/65-sequential-matrix.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/65-sequential-matrix.yml) + +This workflow illustrates how to execute sequencial jobs in specific order using matrix with `max-parallel: 1` strategy. + +[![66 - Matrix Object](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/66-matrix-object.yaml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/66-matrix-object.yaml) + +This workflow illustrates how to manipulate matrix object to perform different operation according to a object type. + +[![67 - From JSON Env Var](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/67-fromjson-env-var.yaml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/67-fromjson-env-var.yaml) + +This workflow illustrates how to extract a specific item from a JSON list stored in a environment variable dynamically. + +[![68 - OS Types](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/68-ostypes.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/68-ostypes.yml) + +This workflow shows the os type value for each github runner os. + +[![69 - Run on Push to RC](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/69-run-on-push-to-rc.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/69-run-on-push-to-rc.yml) + +This workflow illustrates how to extract a semantic version from a Release Candidate branch name. + +[![70 - Post Failure](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/70-post-failure.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/70-post-failure.yml) - AS EXPECTED + +This workflow illustrates how to execute a job when a previous job fails (post failure operations). + +[![71 - Many Outputs Python](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/71-many-outputs-python.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/71-many-outputs-python.yml) + +This workflow illustrates how to save many outputs using a python script and the GITHUB_OUTPUT file. + +[![72 - Trigger on comment](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/72-trigger-on-comment.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/72-trigger-on-comment.yml) + +This workflow illustrates how to start a workflow by commenting using a specific keyword in a Pull Request review. + +[![73 - Check if file exists](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/73-if-file-exists.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/73-if-file-exists.yml) - AS EXPECTED + +This workflow illustrates how to check if a file exists in a workflow after a failure, to perform some custom operations. + +[![74 - n8N integration](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/74-n8n-integration.yml/badge.svg)](https://github.com/GuillaumeFalourd/poc-github-actions/actions/workflows/74-n8n-integration.yml) - AS EXPECTED + +This workflow illustrates how to integrate github actions with a n8n workflow automation (http://n8n.io) using a webhook. \ No newline at end of file diff --git a/aws/test.md b/aws/test.md new file mode 100644 index 0000000000..a6947df6fc --- /dev/null +++ b/aws/test.md @@ -0,0 +1,2 @@ +Related to https://stackoverflow.com/questions/72704563/github-action-echo-within-an-expression +In workflow-tester41.yml \ No newline at end of file diff --git a/azure/test.md b/azure/test.md new file mode 100644 index 0000000000..a6947df6fc --- /dev/null +++ b/azure/test.md @@ -0,0 +1,2 @@ +Related to https://stackoverflow.com/questions/72704563/github-action-echo-within-an-expression +In workflow-tester41.yml \ No newline at end of file diff --git a/backup/.github/auto_assign.yml b/backup/.github/auto_assign.yml new file mode 100644 index 0000000000..0c5ec7b19f --- /dev/null +++ b/backup/.github/auto_assign.yml @@ -0,0 +1,26 @@ +# Set to true to add reviewers to pull requests +addReviewers: true + +# Set to true to add assignees to pull requests +addAssignees: true + +# A list of reviewers to be added to pull requests (GitHub user name) +reviewers: + - GuillaumeFalourd + +# A number of reviewers added to the pull request +# Set 0 to add all the reviewers (default: 0) +numberOfReviewers: 0 + +# A list of assignees, overrides reviewers if set +# assignees: +# - assigneeA + +# A number of assignees to add to the pull request +# Set to 0 to add all of the assignees. +# Uses numberOfReviewers if unset. +# numberOfAssignees: 2 + +# A list of keywords to be skipped the process that add reviewers if pull requests include it +# skipKeywords: +# - wip \ No newline at end of file diff --git a/backup/.github/workflows/action-cond.yml b/backup/.github/workflows/action-cond.yml new file mode 100644 index 0000000000..2783b5f829 --- /dev/null +++ b/backup/.github/workflows/action-cond.yml @@ -0,0 +1,21 @@ +name: Action Cond + +on: [push, pull_request] + +jobs: + add_label: + runs-on: ubuntu-latest + steps: + - name: Determine Checkout Depth + uses: haya14busa/action-cond@v1.0.2 + id: fetchDepth + with: + cond: ${{ github.event_name == 'pull_request' }} + if_true: '0' # string value + if_false: '1' # string value + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: ${{ steps.fetchDepth.outputs.value }} + token: ${{ secrets.ACCESS_TOKEN }} \ No newline at end of file diff --git a/backup/.github/workflows/add-label.yml b/backup/.github/workflows/add-label.yml new file mode 100644 index 0000000000..3047533467 --- /dev/null +++ b/backup/.github/workflows/add-label.yml @@ -0,0 +1,15 @@ +name: Add Label + +on: + issues: + types: opened + +jobs: + add_label: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions-ecosystem/action-add-labels@v1.1.0 + with: + github_token: ${{ secrets.ACCESS_TOKEN }} + labels: documentation diff --git a/backup/.github/workflows/add-reviewers.yml b/backup/.github/workflows/add-reviewers.yml new file mode 100644 index 0000000000..03a09c6ad9 --- /dev/null +++ b/backup/.github/workflows/add-reviewers.yml @@ -0,0 +1,16 @@ +name: Add Reviewers + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Add Reviewers + uses: madrapps/add-reviewers@v1 + with: + token: ${{ secrets.ACCESS_TOKEN }} + reviewers: GuillaumeFalourd + re-request-when-approved: true + re-request-when-changes-requested: true diff --git a/backup/.github/workflows/app-token.yml b/backup/.github/workflows/app-token.yml new file mode 100644 index 0000000000..16ee0b6c8c --- /dev/null +++ b/backup/.github/workflows/app-token.yml @@ -0,0 +1,22 @@ +name: App Token + +on: + workflow_dispatch: + +jobs: + job: + runs-on: ubuntu-18.04 + steps: + - name: Generate token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.PRIVATE_KEY }} + # Optional (defaults to the current repository). + # repository: owner/repo + - name: Use token + env: + TOKEN: ${{ steps.generate_token.outputs.token }} + run: | + echo "The generated token is masked: ${TOKEN}" \ No newline at end of file diff --git a/backup/.github/workflows/assert-command-line-output.yml b/backup/.github/workflows/assert-command-line-output.yml new file mode 100644 index 0000000000..4d8945586e --- /dev/null +++ b/backup/.github/workflows/assert-command-line-output.yml @@ -0,0 +1,196 @@ +name: Assert Command Line Output + +on: + push: + workflow_dispatch: + +jobs: + +# On UBUNTU runners + PASSED-assert-file-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: cat README.md + assert_file_path: README.md + expected_result: PASSED + + FAILED-assert-file-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + assert_file_path: assert.txt + expected_result: FAILED + + PASSED-specific-line-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: cat README.md + assert_file_path: README.md + expected_result: PASSED + specific_line: 1 + + FAILED-specific-line-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + assert_file_path: assert.txt + expected_result: FAILED + specific_line: 2 + + PASSED-contains-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + contains: runner + expected_result: PASSED + + FAILED-contains-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + contains: error + expected_result: FAILED + +# On MACOS runners + PASSED-assert-file-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: cat README.md + assert_file_path: README.md + expected_result: PASSED + + FAILED-assert-file-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + assert_file_path: assert.txt + expected_result: FAILED + + PASSED-specific-line-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: cat README.md + assert_file_path: README.md + expected_result: PASSED + specific_line: 1 + + FAILED-specific-line-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + assert_file_path: assert.txt + expected_result: FAILED + specific_line: 2 + + PASSED-contains-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + contains: runner + expected_result: PASSED + + FAILED-contains-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + contains: error + expected_result: FAILED + +# On WINDOWS runners + PASSED-assert-file-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: cat README.md + assert_file_path: README.md + expected_result: PASSED + + FAILED-assert-file-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + assert_file_path: assert.txt + expected_result: FAILED + + PASSED-specific-line-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: cat README.md + assert_file_path: README.md + expected_result: PASSED + specific_line: 1 + + FAILED-specific-line-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + assert_file_path: assert.txt + expected_result: FAILED + specific_line: 2 + + PASSED-contains-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + contains: runner + expected_result: PASSED + + FAILED-contains-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + - uses: GuillaumeFalourd/assert-command-line-output@v2.3 + with: + command_line: ls -lha + contains: error + expected_result: FAILED diff --git a/backup/.github/workflows/auto-accept-collabs.yml b/backup/.github/workflows/auto-accept-collabs.yml new file mode 100644 index 0000000000..4fab8ebb21 --- /dev/null +++ b/backup/.github/workflows/auto-accept-collabs.yml @@ -0,0 +1,17 @@ +name: Auto Accept Collabs + +on: + workflow_dispatch: + schedule: + - cron: "0 1 * * MON-FRI" # Runs at 01:00 UTC + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - name: Fetching Local Repository + uses: actions/checkout@v3 + - name: Auto Accept Collabs + uses: kbrashears5/github-action-auto-accept-collabs@857db86b3be636b6dedcb36726ec97e0139dc7d7 + with: + TOKEN: ${{ secrets.ACCESS_TOKEN }} diff --git a/backup/.github/workflows/auto-approve.yml b/backup/.github/workflows/auto-approve.yml new file mode 100644 index 0000000000..94cf66835d --- /dev/null +++ b/backup/.github/workflows/auto-approve.yml @@ -0,0 +1,12 @@ +name: Auto approve + +on: [pull_request_target] + +jobs: + auto-approve: + runs-on: ubuntu-latest + steps: + - uses: hmarr/auto-approve-action@v2 + if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/backup/.github/workflows/auto-assign-author.yml b/backup/.github/workflows/auto-assign-author.yml new file mode 100644 index 0000000000..13df53ee7d --- /dev/null +++ b/backup/.github/workflows/auto-assign-author.yml @@ -0,0 +1,14 @@ +name: 'Auto Assign Author' + +on: + pull_request_target: + types: [opened, reopened] + +permissions: + pull-requests: write + +jobs: + assign-author: + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@v1.3.5 \ No newline at end of file diff --git a/backup/.github/workflows/auto-assign.yml b/backup/.github/workflows/auto-assign.yml new file mode 100644 index 0000000000..de3bbc4a34 --- /dev/null +++ b/backup/.github/workflows/auto-assign.yml @@ -0,0 +1,11 @@ +name: 'Auto Assign' + +on: + pull_request: + types: [opened, ready_for_review] + +jobs: + add-reviews: + runs-on: ubuntu-latest + steps: + - uses: kentaro-m/auto-assign-action@v1.2.0 \ No newline at end of file diff --git a/backup/.github/workflows/auto-merge.yml b/backup/.github/workflows/auto-merge.yml new file mode 100644 index 0000000000..b5ddb953b9 --- /dev/null +++ b/backup/.github/workflows/auto-merge.yml @@ -0,0 +1,12 @@ +name: Auto-Merge + +on: pull_request + +jobs: + automerge: + runs-on: ubuntu-latest + steps: + - name: automerge + uses: "pascalgn/automerge-action@v0.13.1" + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/backup/.github/workflows/branch-names.yml b/backup/.github/workflows/branch-names.yml new file mode 100644 index 0000000000..e11f9f7053 --- /dev/null +++ b/backup/.github/workflows/branch-names.yml @@ -0,0 +1,59 @@ +name: Branch Names + +on: [push, workflow_dispatch] + +jobs: + branch-names: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get branch names + id: branch-name + uses: tj-actions/branch-names@v7.0.7 + + - name: Running on the default branch. + if: steps.branch-name.outputs.is_default == 'true' + run: | + echo "Running on default: ${{ steps.branch-name.outputs.current_branch }}" + # Outputs: "Running on default: main". + + - name: Running on a pull request branch. + if: steps.branch-name.outputs.is_default == 'false' + run: | + echo "Running on pr: ${{ steps.branch-name.outputs.current_branch }}" + # Outputs: "Running on pr: feature/test". + + - name: Current branch name + if: github.event_name == 'pull_request' + run: | + echo "${{ steps.branch-name.outputs.current_branch }}" + # Outputs: "feature/test" current PR branch. + + - name: Current branch name + if: github.event_name == 'push' + run: | + echo "${{ steps.branch-name.outputs.current_branch }}" + # Outputs: "main" the branch that triggered the push event. + + - name: Get Ref branch name + run: | + echo "${{ steps.branch-name.outputs.ref_branch }}" + # Outputs: "main" for non PR branches | "1/merge" for a PR branch + + - name: Get Head Ref branch name + if: github.event_name == 'pull_request' + run: | + echo "${{ steps.branch-name.outputs.head_ref_branch }}" + # Outputs: "feature/test" current PR branch. + + - name: Get Base Ref branch name + if: github.event_name == 'pull_request' + run: | + echo "${{ steps.branch-name.outputs.base_ref_branch }}" + # Outputs: "main" for main <- PR branch. + + - name: Get the current tag + if: startsWith(github.ref, 'refs/tags/') + run: | + echo "${{ steps.branch-name.outputs.tag }}" + # Outputs: "v0.0.1" OR "0.0.1" \ No newline at end of file diff --git a/backup/.github/workflows/cache.yml b/backup/.github/workflows/cache.yml new file mode 100644 index 0000000000..45c9d52720 --- /dev/null +++ b/backup/.github/workflows/cache.yml @@ -0,0 +1,24 @@ +name: Cache + +on: push + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Cache Primes + id: cache-primes + uses: actions/cache@v2 + with: + path: prime-numbers + key: ${{ runner.os }}-primes + + - name: Generate Prime Numbers + if: steps.cache-primes.outputs.cache-hit != 'true' + run: echo "generates prime-numbers" + + - name: Use Prime Numbers + run: echo "use prime-numbers" \ No newline at end of file diff --git a/backup/.github/workflows/cancel-workflow.yml b/backup/.github/workflows/cancel-workflow.yml new file mode 100644 index 0000000000..c899c757d3 --- /dev/null +++ b/backup/.github/workflows/cancel-workflow.yml @@ -0,0 +1,15 @@ +name: Cancel Workflow + +on: [push] + +jobs: + cancel: + name: 'Cancel Previous Runs' + runs-on: ubuntu-latest + timeout-minutes: 3 + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + with: + workflow_id: 'checkout.yml' + access_token: ${{ github.token }} \ No newline at end of file diff --git a/backup/.github/workflows/changed-files.yml b/backup/.github/workflows/changed-files.yml new file mode 100644 index 0000000000..ea92d7d8ba --- /dev/null +++ b/backup/.github/workflows/changed-files.yml @@ -0,0 +1,28 @@ +name: Changed Files + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest # windows-latest | macos-latest + name: Test changed-files + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v41.0.1 + + - name: List all changed files + run: | + for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + echo "$file was changed" + done diff --git a/backup/.github/workflows/checkout.yml b/backup/.github/workflows/checkout.yml new file mode 100644 index 0000000000..b0859a9da8 --- /dev/null +++ b/backup/.github/workflows/checkout.yml @@ -0,0 +1,22 @@ +name: Checkout + +on: + push: + branches: + - 'dev' # For the dev branch + schedule: + - cron: "0 0 * * MON-FRI" # Runs at 00:00 UTC + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: | + date > checkout-workflow.txt + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "generated checkout workflow file" + git push diff --git a/backup/.github/workflows/close-pull-request.yml b/backup/.github/workflows/close-pull-request.yml new file mode 100644 index 0000000000..526f6b6bf7 --- /dev/null +++ b/backup/.github/workflows/close-pull-request.yml @@ -0,0 +1,15 @@ +name: Close Pull Request + +on: + pull_request_target: + types: [opened, reopened] + paths: + - '**/close-pull-request.yml' + +jobs: + test: + runs-on: "ubuntu-latest" + steps: + - uses: superbrothers/close-pull-request@v3 + with: + comment: "Hi, this PR will be closed automatically. Please do not touch the 'close-pull-request.yml' file." diff --git a/backup/.github/workflows/commit-and-push.yml b/backup/.github/workflows/commit-and-push.yml new file mode 100644 index 0000000000..967d437880 --- /dev/null +++ b/backup/.github/workflows/commit-and-push.yml @@ -0,0 +1,31 @@ +name: Commit and Push + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + commit-and-push: + name: commit-and-push + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v2 + with: + ref: main + + - name: Make changes + run: date > commit-and-push-workflow.txt + + - name: Push code + uses: github-actions-x/commit@v2.9 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + push-branch: 'main' + commit-message: 'commit and push updated report' + force-add: 'true' + files: commit-and-push-workflow.txt + name: ${{ github.actor }} + email: ${{ github.actor }}@users.noreply.github.com diff --git a/backup/.github/workflows/compress-image.yml b/backup/.github/workflows/compress-image.yml new file mode 100644 index 0000000000..9b6b15f9e5 --- /dev/null +++ b/backup/.github/workflows/compress-image.yml @@ -0,0 +1,22 @@ +name: Compress Images + +on: + pull_request: + # Run Image Actions when JPG, JPEG, PNG or WebP files are added or changed. + # See https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#onpushpull_requestpaths for reference. + paths: + - '**.jpg' + - '**.jpeg' + - '**.png' + - '**.webp' +jobs: + build: + name: calibreapp/image-actions + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v2 + - name: Compress Images + uses: calibreapp/image-actions@main + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/backup/.github/workflows/copycat.yml b/backup/.github/workflows/copycat.yml new file mode 100644 index 0000000000..c4d16933fc --- /dev/null +++ b/backup/.github/workflows/copycat.yml @@ -0,0 +1,22 @@ +name: Copycat + +on: [push, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + - name: Make changes + run: date > copycat-workflow.txt + - name: Copy + uses: andstor/copycat-action@v3 + with: + personal_token: ${{ secrets.ACCESS_TOKEN }} + src_path: /. + dst_path: /backup/ + dst_owner: GuillaumeFalourd + dst_repo_name: poc-github-actions + src_branch: main + dst_branch: main \ No newline at end of file diff --git a/backup/.github/workflows/create-json.yml b/backup/.github/workflows/create-json.yml new file mode 100644 index 0000000000..86c905f4f2 --- /dev/null +++ b/backup/.github/workflows/create-json.yml @@ -0,0 +1,16 @@ +name: Create JSON + +on: [push, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: cat file.json + - name: create-json + uses: jsdaniell/create-json@1.1.2 + with: + name: "file.json" + json: '{"appId":"foofoo", "secret_token":"${{ secrets.SECRET_TEST }}"}' + - run: cat file.json \ No newline at end of file diff --git a/backup/.github/workflows/create-pull-request.yml b/backup/.github/workflows/create-pull-request.yml new file mode 100644 index 0000000000..06187c84a6 --- /dev/null +++ b/backup/.github/workflows/create-pull-request.yml @@ -0,0 +1,42 @@ +name: Create Pull Request + +on: + schedule: + - cron: "0 6 * * MON-FRI" # Runs at 06:00 UTC + workflow_dispatch: + +jobs: + createPullRequest: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Make changes to pull request + run: date > pull-request-workflow.txt + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.ACCESS_TOKEN }} + commit-message: Update report + committer: GitHub + author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> + signoff: false + delete-branch: true + title: '[Example] Update report' + body: | + Update report + - Updated with *today's* date + - Auto-generated by [create-pull-request][1] + labels: | + report + automerge + automated pr + assignees: GuillaumeFalourd + draft: false + + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file diff --git a/backup/.github/workflows/curl.yml b/backup/.github/workflows/curl.yml new file mode 100644 index 0000000000..702d658583 --- /dev/null +++ b/backup/.github/workflows/curl.yml @@ -0,0 +1,12 @@ +name: Curl + +on: [push, workflow_dispatch] + +jobs: + curl: + runs-on: ubuntu-latest + steps: + - name: curl + uses: wei/curl@v1.1.1 + with: + args: https://httpbin.org/get \ No newline at end of file diff --git a/backup/.github/workflows/debug.yml b/backup/.github/workflows/debug.yml new file mode 100644 index 0000000000..da366f8801 --- /dev/null +++ b/backup/.github/workflows/debug.yml @@ -0,0 +1,9 @@ +name: Debug + +on: push + +jobs: + debug: + runs-on: ubuntu-latest + steps: + - uses: hmarr/debug-action@v2 \ No newline at end of file diff --git a/backup/.github/workflows/delete-artifact.yml b/backup/.github/workflows/delete-artifact.yml new file mode 100644 index 0000000000..f9fab1d259 --- /dev/null +++ b/backup/.github/workflows/delete-artifact.yml @@ -0,0 +1,22 @@ +name: Delete Artifacts + +on: [push, workflow_dispatch] + + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - run: echo hello > world.txt + + - uses: actions/upload-artifact@v1 + with: + name: my-artifact + path: world.txt + + # delete-artifact + - uses: geekyeggo/delete-artifact@v1 + with: + name: my-artifact \ No newline at end of file diff --git a/backup/.github/workflows/enforce-labels.yml b/backup/.github/workflows/enforce-labels.yml new file mode 100644 index 0000000000..a4a276a7c8 --- /dev/null +++ b/backup/.github/workflows/enforce-labels.yml @@ -0,0 +1,15 @@ +name: Enforce PR labels + +on: + pull_request: + types: [labeled, unlabeled, opened, edited, synchronize] + +jobs: + enforce-label: + runs-on: ubuntu-latest + steps: + - uses: yogevbd/enforce-label-action@2.1.0 + with: + REQUIRED_LABELS_ANY: "bug,enhancement,skip-changelog,test" + REQUIRED_LABELS_ANY_DESCRIPTION: "Select at least one label ['bug','enhancement','skip-changelog','test']" + BANNED_LABELS: "banned" \ No newline at end of file diff --git a/backup/.github/workflows/env-vars.yml b/backup/.github/workflows/env-vars.yml new file mode 100644 index 0000000000..e7ac9446fd --- /dev/null +++ b/backup/.github/workflows/env-vars.yml @@ -0,0 +1,137 @@ +name: Env Vars + +on: [push] + +jobs: + linux: + name: Linux Demo + runs-on: ubuntu-latest + steps: + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Print environment variables exposed by this action + run: | + echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$CI_REPOSITORY" + echo "CI_REF_SLUG=$CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" + echo "CI_REF=$CI_REF" + echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$CI_BASE_REF" + echo "CI_SHA_SHORT=$CI_SHA_SHORT" + echo "CI_SHA=$CI_SHA" + echo "CI_ACTOR=$CI_ACTOR" + echo "CI_EVENT_NAME=$CI_EVENT_NAME" + echo "CI_RUN_ID=$CI_RUN_ID" + echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" + echo "CI_WORKFLOW=$CI_WORKFLOW" + echo "CI_ACTION=$CI_ACTION" + - name: Print environment variables exposed by GitHub + run: | + echo "GITHUB_ACTOR=$GITHUB_ACTOR" + echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" + echo "GITHUB_SHA=$GITHUB_SHA" + echo "GITHUB_REF=$GITHUB_REF" + echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" + echo "GITHUB_BASE_REF=$GITHUB_BASE_REF" + echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME" + echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" + echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" + echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW" + echo "GITHUB_ACTION=$GITHUB_ACTION" + windows: + name: Windows Demo + runs-on: windows-latest + steps: + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Print environment variables exposed by this action + run: | + echo "CI_REPOSITORY_SLUG=$Env:CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$Env:CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$Env:CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$Env:CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$Env:CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$Env:CI_REPOSITORY" + echo "CI_REF_SLUG=$Env:CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$Env:CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$Env:CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$Env:CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$Env:CI_REF_NAME_SLUG" + echo "CI_REF=$Env:CI_REF" + echo "CI_HEAD_REF_SLUG=$Env:CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$Env:CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$Env:CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$Env:CI_BASE_REF" + echo "CI_SHA_SHORT=$Env:CI_SHA_SHORT" + echo "CI_SHA=$Env:CI_SHA" + echo "CI_ACTOR=$Env:CI_ACTOR" + echo "CI_EVENT_NAME=$Env:CI_EVENT_NAME" + echo "CI_RUN_ID=$Env:CI_RUN_ID" + echo "CI_RUN_NUMBER=$Env:CI_RUN_NUMBER" + echo "CI_WORKFLOW=$Env:CI_WORKFLOW" + echo "CI_ACTION=$Env:CI_ACTION" + - name: Print environment variables exposed by GitHub + run: | + echo "GITHUB_ACTOR=$Env:GITHUB_ACTOR" + echo "GITHUB_REPOSITORY=$Env:GITHUB_REPOSITORY" + echo "GITHUB_SHA=$Env:GITHUB_SHA" + echo "GITHUB_REF=$Env:GITHUB_REF" + echo "GITHUB_HEAD_REF=$Env:GITHUB_HEAD_REF" + echo "GITHUB_BASE_REF=$Env:GITHUB_BASE_REF" + echo "GITHUB_EVENT_NAME=$Env:GITHUB_EVENT_NAME" + echo "GITHUB_RUN_ID=$Env:GITHUB_RUN_ID" + echo "GITHUB_RUN_NUMBER=$Env:GITHUB_RUN_NUMBER" + echo "GITHUB_WORKFLOW=$Env:GITHUB_WORKFLOW" + echo "GITHUB_ACTION=$Env:GITHUB_ACTION" + macos: + name: macOS Demo + runs-on: macos-latest + steps: + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Print environment variables exposed by this action + run: | + echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$CI_REPOSITORY" + echo "CI_REF_SLUG=$CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" + echo "CI_REF=$CI_REF" + echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$CI_BASE_REF" + echo "CI_SHA_SHORT=$CI_SHA_SHORT" + echo "CI_SHA=$CI_SHA" + echo "CI_ACTOR=$CI_ACTOR" + echo "CI_EVENT_NAME=$CI_EVENT_NAME" + echo "CI_RUN_ID=$CI_RUN_ID" + echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" + echo "CI_WORKFLOW=$CI_WORKFLOW" + echo "CI_ACTION=$CI_ACTION" + - name: Print environment variables exposed by GitHub + run: | + echo "GITHUB_ACTOR=$GITHUB_ACTOR" + echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" + echo "GITHUB_SHA=$GITHUB_SHA" + echo "GITHUB_REF=$GITHUB_REF" + echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" + echo "GITHUB_BASE_REF=$GITHUB_BASE_REF" + echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME" + echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" + echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" + echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW" + echo "GITHUB_ACTION=$GITHUB_ACTION" \ No newline at end of file diff --git a/backup/.github/workflows/file-existence.yml b/backup/.github/workflows/file-existence.yml new file mode 100644 index 0000000000..556cd273cc --- /dev/null +++ b/backup/.github/workflows/file-existence.yml @@ -0,0 +1,21 @@ +name: "File Existence" + +on: [push, pull_request, workflow_dispatch] + +jobs: + file_existence: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2.3.4 + + - name: Check file existence + id: check_files + uses: andstor/file-existence-action@v1 + with: + files: "README.md" + + - name: File exists + if: steps.check_files.outputs.files_exists == 'true' + # Only runs if all of the files exists + run: echo All files exists! \ No newline at end of file diff --git a/backup/.github/workflows/first-interaction.yml b/backup/.github/workflows/first-interaction.yml new file mode 100644 index 0000000000..b1e97ecc29 --- /dev/null +++ b/backup/.github/workflows/first-interaction.yml @@ -0,0 +1,16 @@ +name: First Interaction + +on: + pull_request: + issues: + types: opened + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: "Thank you for opening this ISSUE. We'll give you a return ASAP 👍" + pr-message: "Thank you for your contribution. We'll give you a return ASAP 👍" diff --git a/backup/.github/workflows/get-workflow-origin-run.yml b/backup/.github/workflows/get-workflow-origin-run.yml new file mode 100644 index 0000000000..fdbad021b0 --- /dev/null +++ b/backup/.github/workflows/get-workflow-origin-run.yml @@ -0,0 +1,44 @@ +name: Get Workflow Origin Information (Run) + +on: + workflow_run: + workflows: ['Get information'] + types: ['requested'] + +jobs: + get-info: + name: "Get information about the source run" + runs-on: ubuntu-latest + outputs: + sourceHeadRepo: ${{ steps.source-run-info.outputs.sourceHeadRepo }} + sourceHeadBranch: ${{ steps.source-run-info.outputs.sourceHeadBranch }} + sourceHeadSha: ${{ steps.source-run-info.outputs.sourceHeadSha }} + mergeCommitSha: ${{ steps.source-run-info.outputs.mergeCommitSha }} + targetCommitSha: ${{ steps.source-run-info.outputs.targetCommitSha }} + pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }} + pullRequestLabels: ${{ steps.source-run-info.outputs.pullRequestLabels }} + targetBranch: ${{ steps.source-run-info.outputs.targetBranch }} + sourceEvent: ${{ steps.source-run-info.outputs.sourceEvent }} + steps: + - name: "Get information about the origin 'CI' run" + uses: potiuk/get-workflow-origin@v1_1 + id: source-run-info + with: + token: ${{ secrets.GITHUB_TOKEN }} + sourceRunId: ${{ github.event.workflow_run.id }}``` + + test-info: + runs-on: ubuntu-latest + needs: get-info + steps: + - name: Output + run: | + echo ${{needs.get-info.outputs.sourceHeadRepo}} + echo ${{needs.get-info.outputs.sourceHeadBranch}} + echo ${{needs.get-info.outputs.sourceHeadSha}} + echo ${{needs.get-info.outputs.mergeCommitSha}} + echo ${{needs.get-info.outputs.targetCommitSha}} + echo ${{needs.get-info.outputs.pullRequestNumber}} + echo ${{needs.get-info.outputs.pullRequestLabels}} + echo ${{needs.get-info.outputs.targetBranch}} + echo ${{needs.get-info.outputs.sourceEvent}} \ No newline at end of file diff --git a/backup/.github/workflows/get-workflow-origin.yml b/backup/.github/workflows/get-workflow-origin.yml new file mode 100644 index 0000000000..20826918ac --- /dev/null +++ b/backup/.github/workflows/get-workflow-origin.yml @@ -0,0 +1,42 @@ +name: Get Workflow Origin Information (PR) +on: + pull_request: + branches: ['main'] + +jobs: + get-info: + name: "Get information about the source run" + runs-on: ubuntu-latest + outputs: + sourceHeadRepo: ${{ steps.workflow-run-info.outputs.sourceHeadRepo }} + sourceHeadBranch: ${{ steps.workflow-run-info.outputs.sourceHeadBranch }} + sourceHeadSha: ${{ steps.workflow-run-info.outputs.sourceHeadSha }} + mergeCommitSha: ${{ steps.workflow-run-info.outputs.mergeCommitSha }} + targetCommitSha: ${{ steps.workflow-run-info.outputs.targetCommitSha }} + pullRequestNumber: ${{ steps.workflow-run-info.outputs.pullRequestNumber }} + pullRequestLabels: ${{ steps.workflow-run-info.outputs.pullRequestLabels }} + targetBranch: ${{ steps.source-run-info.outputs.targetBranch }} + sourceEvent: ${{ steps.workflow-run-info.outputs.sourceEvent }} + steps: + - name: "Get information about the current run" + uses: potiuk/get-workflow-origin@v1_3 + id: workflow-run-info + with: + token: ${{ secrets.GITHUB_TOKEN }} + sourceRunId: ${{ github.event.workflow_run.id }} + + test-info: + runs-on: ubuntu-latest + needs: get-info + steps: + - name: Output + run: | + echo ${{needs.get-info.outputs.sourceHeadRepo}} + echo ${{needs.get-info.outputs.sourceHeadBranch}} + echo ${{needs.get-info.outputs.sourceHeadSha}} + echo ${{needs.get-info.outputs.mergeCommitSha}} + echo ${{needs.get-info.outputs.targetCommitSha}} + echo ${{needs.get-info.outputs.pullRequestNumber}} + echo ${{needs.get-info.outputs.pullRequestLabels}} + echo ${{needs.get-info.outputs.targetBranch}} + echo ${{needs.get-info.outputs.sourceEvent}} \ No newline at end of file diff --git a/backup/.github/workflows/ghaction-container-scan.yml b/backup/.github/workflows/ghaction-container-scan.yml new file mode 100644 index 0000000000..358a027c9d --- /dev/null +++ b/backup/.github/workflows/ghaction-container-scan.yml @@ -0,0 +1,37 @@ +name: Github Action Container Scan + +on: + push: + +jobs: + scan: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Comment as DOCKER secrets not set + + # - name: Login to DockerHub + # uses: docker/login-action@v2 + # with: + # username: ${{ secrets.DOCKERHUB_USERNAME }} + # password: ${{ secrets.DOCKERHUB_TOKEN }} + + # - name: Build + # uses: docker/build-push-action@v3 + # with: + # context: . + # push: true + # tags: user/app:latest + + # - name: Scan for vulnerabilities + # uses: crazy-max/ghaction-container-scan@v1 + # with: + # image: user/app:latest \ No newline at end of file diff --git a/backup/.github/workflows/ghaction-dump-context.yml b/backup/.github/workflows/ghaction-dump-context.yml new file mode 100644 index 0000000000..8f8618cede --- /dev/null +++ b/backup/.github/workflows/ghaction-dump-context.yml @@ -0,0 +1,13 @@ +name: Github Action Dump Context + +on: + push: + pull_request: + +jobs: + dump: + runs-on: ubuntu-latest + steps: + - + name: Dump context + uses: crazy-max/ghaction-dump-context@v1 \ No newline at end of file diff --git a/backup/.github/workflows/ghaction-github-status.yml b/backup/.github/workflows/ghaction-github-status.yml new file mode 100644 index 0000000000..ef901dfd94 --- /dev/null +++ b/backup/.github/workflows/ghaction-github-status.yml @@ -0,0 +1,16 @@ +name: Github Action Github Status + +on: push + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check GitHub Status + uses: crazy-max/ghaction-github-status@v3 + with: + overall_threshold: minor + pages_threshold: partial_outage + + - name: Checkout + uses: actions/checkout@v3 \ No newline at end of file diff --git a/backup/.github/workflows/git-auto-commit.yml b/backup/.github/workflows/git-auto-commit.yml new file mode 100644 index 0000000000..d55c439566 --- /dev/null +++ b/backup/.github/workflows/git-auto-commit.yml @@ -0,0 +1,79 @@ +name: Git Auto Commit + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + + - name: Make changes + run: date > git-auto-commit-workflow.txt + + - name: Add txt file + run: git add git-auto-commit-workflow.txt + + - name: Push code + uses: stefanzweifel/git-auto-commit-action@v4 + with: + # Optional, but recommended + # Defaults to "Apply automatic changes" + commit_message: Automated Change + + # Optional branch name where commit should be pushed to. + # Defaults to the current branch. + branch: main + + # Optional. Used by `git-commit`. + # See https://git-scm.com/docs/git-commit#_options + commit_options: '--no-verify --signoff' + + # Optional glob pattern of files which should be added to the commit + # Defaults to all (.) + # See the `pathspec`-documentation for git + # - https://git-scm.com/docs/git-add#Documentation/git-add.txt-ltpathspecgt82308203 + # - https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec + file_pattern: . + + # Optional local file path to the repository + # Defaults to the root of the repository + repository: . + + # Optional commit user and author settings + commit_user_name: My GitHub Actions Bot # defaults to "GitHub Actions" + commit_user_email: my-github-actions-bot@example.org # defaults to "actions@github.com" + commit_author: Author # defaults to author of the commit that triggered the run + + # Optional tag message + # Action will create and push a new tag to the remote repository and the defined branch + tagging_message: 'v1.0.0' + + # Optional. Used by `git-status` + # See https://git-scm.com/docs/git-status#_options + status_options: '--untracked-files=no' + + # Optional. Used by `git-add` + # See https://git-scm.com/docs/git-add#_options + add_options: '-u' + + # Optional. Used by `git-push` + # See https://git-scm.com/docs/git-push#_options + push_options: '--force' + + # Optional. Disable dirty check and always try to create a commit and push + skip_dirty_check: true + + # Optional. Skip internal call to `git fetch` + skip_fetch: true + + # Optional. Prevents the shell from expanding filenames. + # Details: https://www.gnu.org/software/bash/manual/html_node/Filename-Expansion.html + disable_globbing: true \ No newline at end of file diff --git a/backup/.github/workflows/github-environment-variables.yml b/backup/.github/workflows/github-environment-variables.yml new file mode 100644 index 0000000000..065997ff91 --- /dev/null +++ b/backup/.github/workflows/github-environment-variables.yml @@ -0,0 +1,142 @@ +name: Github Environment Variables + +on: [push, pull_request] + +jobs: + linux: + runs-on: ubuntu-latest + steps: + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Print environment variables exposed by this action + run: | + echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$CI_REPOSITORY" + echo "CI_REF_SLUG=$CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" + echo "CI_REF=$CI_REF" + echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$CI_BASE_REF" + echo "CI_SHA_SHORT=$CI_SHA_SHORT" + echo "CI_SHA=$CI_SHA" + echo "CI_PR_TITLE=$CI_PR_TITLE" + echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION" + echo "CI_ACTOR=$CI_ACTOR" + echo "CI_EVENT_NAME=$CI_EVENT_NAME" + echo "CI_RUN_ID=$CI_RUN_ID" + echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" + echo "CI_WORKFLOW=$CI_WORKFLOW" + echo "CI_ACTION=$CI_ACTION" + - name: Print environment variables exposed by GitHub + run: | + echo "GITHUB_ACTOR=$GITHUB_ACTOR" + echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" + echo "GITHUB_SHA=$GITHUB_SHA" + echo "GITHUB_REF=$GITHUB_REF" + echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" + echo "GITHUB_BASE_REF=$GITHUB_BASE_REF" + echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME" + echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" + echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" + echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW" + echo "GITHUB_ACTION=$GITHUB_ACTION" + + windows: + runs-on: windows-latest + steps: + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Print environment variables exposed by this action + run: | + echo "CI_REPOSITORY_SLUG=$Env:CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$Env:CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$Env:CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$Env:CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$Env:CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$Env:CI_REPOSITORY" + echo "CI_REF_SLUG=$Env:CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$Env:CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$Env:CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$Env:CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$Env:CI_REF_NAME_SLUG" + echo "CI_REF=$Env:CI_REF" + echo "CI_HEAD_REF_SLUG=$Env:CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$Env:CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$Env:CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$Env:CI_BASE_REF" + echo "CI_SHA_SHORT=$Env:CI_SHA_SHORT" + echo "CI_SHA=$Env:CI_SHA" + echo "CI_PR_TITLE=$Env:CI_PR_TITLE" + echo "CI_PR_DESCRIPTION=$Env:CI_PR_DESCRIPTION" + echo "CI_ACTOR=$Env:CI_ACTOR" + echo "CI_EVENT_NAME=$Env:CI_EVENT_NAME" + echo "CI_RUN_ID=$Env:CI_RUN_ID" + echo "CI_RUN_NUMBER=$Env:CI_RUN_NUMBER" + echo "CI_WORKFLOW=$Env:CI_WORKFLOW" + echo "CI_ACTION=$Env:CI_ACTION" + - name: Print environment variables exposed by GitHub + run: | + echo "GITHUB_ACTOR=$Env:GITHUB_ACTOR" + echo "GITHUB_REPOSITORY=$Env:GITHUB_REPOSITORY" + echo "GITHUB_SHA=$Env:GITHUB_SHA" + echo "GITHUB_REF=$Env:GITHUB_REF" + echo "GITHUB_HEAD_REF=$Env:GITHUB_HEAD_REF" + echo "GITHUB_BASE_REF=$Env:GITHUB_BASE_REF" + echo "GITHUB_EVENT_NAME=$Env:GITHUB_EVENT_NAME" + echo "GITHUB_RUN_ID=$Env:GITHUB_RUN_ID" + echo "GITHUB_RUN_NUMBER=$Env:GITHUB_RUN_NUMBER" + echo "GITHUB_WORKFLOW=$Env:GITHUB_WORKFLOW" + echo "GITHUB_ACTION=$Env:GITHUB_ACTION" + + macos: + runs-on: macos-latest + steps: + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Print environment variables exposed by this action + run: | + echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" + echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" + echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" + echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" + echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" + echo "CI_REPOSITORY=$CI_REPOSITORY" + echo "CI_REF_SLUG=$CI_REF_SLUG" + echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" + echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" + echo "CI_REF_NAME=$CI_REF_NAME" + echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" + echo "CI_REF=$CI_REF" + echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" + echo "CI_HEAD_REF=$CI_HEAD_REF" + echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" + echo "CI_BASE_REF=$CI_BASE_REF" + echo "CI_SHA_SHORT=$CI_SHA_SHORT" + echo "CI_SHA=$CI_SHA" + echo "CI_PR_TITLE=$CI_PR_TITLE" + echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION" + echo "CI_ACTOR=$CI_ACTOR" + echo "CI_EVENT_NAME=$CI_EVENT_NAME" + echo "CI_RUN_ID=$CI_RUN_ID" + echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" + echo "CI_WORKFLOW=$CI_WORKFLOW" + echo "CI_ACTION=$CI_ACTION" + - name: Print environment variables exposed by GitHub + run: | + echo "GITHUB_ACTOR=$GITHUB_ACTOR" + echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" + echo "GITHUB_SHA=$GITHUB_SHA" + echo "GITHUB_REF=$GITHUB_REF" + echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" + echo "GITHUB_BASE_REF=$GITHUB_BASE_REF" + echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME" + echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" + echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" + echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW" + echo "GITHUB_ACTION=$GITHUB_ACTION" \ No newline at end of file diff --git a/backup/.github/workflows/github-script.yml b/backup/.github/workflows/github-script.yml new file mode 100644 index 0000000000..399b05d9a5 --- /dev/null +++ b/backup/.github/workflows/github-script.yml @@ -0,0 +1,20 @@ +name: Github Script + +on: + issues: + types: [opened] + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '👋 Thanks for reporting!' + }) \ No newline at end of file diff --git a/backup/.github/workflows/gitleaks.yml b/backup/.github/workflows/gitleaks.yml new file mode 100644 index 0000000000..1a5691dc07 --- /dev/null +++ b/backup/.github/workflows/gitleaks.yml @@ -0,0 +1,13 @@ +name: Gitleaks + +on: [push, pull_request, workflow_dispatch] + +jobs: + gitleaks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: '0' + - name: gitleaks-action + uses: zricethezav/gitleaks-action@master \ No newline at end of file diff --git a/backup/.github/workflows/gpt-review.yml b/backup/.github/workflows/gpt-review.yml new file mode 100644 index 0000000000..9cabc38e1d --- /dev/null +++ b/backup/.github/workflows/gpt-review.yml @@ -0,0 +1,23 @@ +name: GPT Review + +on: + pull_request: + +jobs: + gpt-review: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Chat GPT Code Peer Review + uses: edelauna/gpt-review@v1.2.1 + with: + # OpenAI API key used for sending patch diffs for review. + # Required + openai_api_key: ${{ secrets.OPENAI_API_KEY }} + + # The target branch for the git diff to run against. + # Default: ${{ github.base_ref }} + target_branch: '' + + # List of comma seperated values for files to ignore as part of the review process. + ignore_files: '' diff --git a/backup/.github/workflows/hadolint.yml b/backup/.github/workflows/hadolint.yml new file mode 100644 index 0000000000..0d4b862feb --- /dev/null +++ b/backup/.github/workflows/hadolint.yml @@ -0,0 +1,15 @@ +name: Hadolint + +on: [push, pull_request] + +jobs: + hadolint: + name: hadolint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: hadolint + uses: burdzwastaken/hadolint-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HADOLINT_ACTION_DOCKERFILE_FOLDER: . \ No newline at end of file diff --git a/backup/.github/workflows/horusec.yml b/backup/.github/workflows/horusec.yml new file mode 100644 index 0000000000..4d1d7e5fad --- /dev/null +++ b/backup/.github/workflows/horusec.yml @@ -0,0 +1,22 @@ +name: Horusec + +on: [push, workflow_dispatch] + +jobs: + checking_code: + runs-on: ubuntu-latest + name: Horusec Scan + steps: + - name: Check out code + uses: actions/checkout@v2.3.4 + with: # Required when commit authors is enabled + fetch-depth: 0 +# - name: Run Horusec +# id: run_horusec +# uses: fike/horusec-action@main +# with: +# arguments: -p="./" --ignore="**/.vscode/**, **/*.env, **/.mypy_cache/**, **/tests/**" + - name: Running Horusec Security + run: | + curl -fsSL https://raw.githubusercontent.com/ZupIT/horusec/main/deployments/scripts/install.sh | bash -s latest + horusec start -p="./" -e="true" --ignore="**/.vscode/**, **/*.env, **/.mypy_cache/**, **/tests/**" diff --git a/backup/.github/workflows/manual-approval.yml b/backup/.github/workflows/manual-approval.yml new file mode 100644 index 0000000000..46cf394970 --- /dev/null +++ b/backup/.github/workflows/manual-approval.yml @@ -0,0 +1,24 @@ +name: Manual Approval + +on: + workflow_dispatch: + +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - name: Build + run: echo building + + deploy: + name: deploy + runs-on: ubuntu-latest + needs: build + steps: + - uses: trstringer/manual-approval@v1 + with: + secret: ${{ github.TOKEN }} + approvers: GuillaumeFalourd + - name: Deploy to production + run: echo deploying \ No newline at end of file diff --git a/backup/.github/workflows/paths-filter.yml b/backup/.github/workflows/paths-filter.yml new file mode 100644 index 0000000000..923f85a871 --- /dev/null +++ b/backup/.github/workflows/paths-filter.yml @@ -0,0 +1,25 @@ +name: Paths Filter + +on: [push, workflow_dispatch] + +jobs: + paths-filter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + workflows: + - '.github/workflows/**' + + # run only if 'workflows' files were changed + - name: workflow tests + if: steps.filter.outputs.workflows == 'true' + run: echo "Workflow file" + + # run only if not 'workflows' files were changed + - name: not workflow tests + if: steps.filter.outputs.workflows != 'true' + run: echo "NOT workflow file" \ No newline at end of file diff --git a/backup/.github/workflows/phonito.yml b/backup/.github/workflows/phonito.yml new file mode 100644 index 0000000000..c5fb890247 --- /dev/null +++ b/backup/.github/workflows/phonito.yml @@ -0,0 +1,26 @@ +name: Phonito + +on: [push] + +jobs: + + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Set tag var + id: vars + run: echo ::set-output name=docker_tag::$(echo ${GITHUB_REF} | cut -d'/' -f3)-${GITHUB_SHA} + + - name: Build the Docker image + run: docker build . --file Dockerfile --tag myapp:${{ steps.vars.outputs.docker_tag }} + + # Comment as PHONITO secret not set + # - name: Scan with Phonito Security + # uses: phonito/phonito-scanner-action@master + # with: + # image: myapp:${{ steps.vars.outputs.docker_tag }} + # phonito-token: ${{ secrets.PHONITO_TOKEN }} \ No newline at end of file diff --git a/backup/.github/workflows/publish-docker.yml b/backup/.github/workflows/publish-docker.yml new file mode 100644 index 0000000000..7b00e86f86 --- /dev/null +++ b/backup/.github/workflows/publish-docker.yml @@ -0,0 +1,17 @@ +name: Publish Docker + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + + # Comment as DOCKER secrets not set + # - name: Publish to Registry + # uses: elgohr/Publish-Docker-Github-Action@master + # with: + # name: myDocker/repository + # username: ${{ secrets.DOCKER_USERNAME }} + # password: ${{ secrets.DOCKER_PASSWORD }} \ No newline at end of file diff --git a/backup/.github/workflows/pull-request.yml b/backup/.github/workflows/pull-request.yml new file mode 100644 index 0000000000..f291f77f2b --- /dev/null +++ b/backup/.github/workflows/pull-request.yml @@ -0,0 +1,14 @@ +name: Pull Request + +on: [push, workflow_dispatch] + +jobs: + pull-request: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: pull-request + uses: repo-sync/pull-request@v2 + with: + destination_branch: "main" + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/backup/.github/workflows/purge-artifacts.yml b/backup/.github/workflows/purge-artifacts.yml new file mode 100644 index 0000000000..5c67f9387b --- /dev/null +++ b/backup/.github/workflows/purge-artifacts.yml @@ -0,0 +1,13 @@ +name: 'Delete old artifacts' +on: + schedule: + - cron: '0 * * * MON-FRI' + +jobs: + delete-artifacts: + runs-on: ubuntu-latest + steps: + - uses: kolpav/purge-artifacts-action@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + expire-in: 7days # Setting this to 0 will delete all artifacts (https://github.com/jkroso/parse-duration) diff --git a/backup/.github/workflows/read-file.yml b/backup/.github/workflows/read-file.yml new file mode 100644 index 0000000000..d43fa23ec4 --- /dev/null +++ b/backup/.github/workflows/read-file.yml @@ -0,0 +1,17 @@ +name: Read File + +on: + workflow_dispatch: + +jobs: + job: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - name: Read checkout-workflow.txt + id: txt + uses: juliangruber/read-file-action@v1 + with: + path: ./checkout-workflow.txt + - name: Echo checkout-workflow.txt + run: echo "${{ steps.txt.outputs.content }}" \ No newline at end of file diff --git a/backup/.github/workflows/recreate-release.yml b/backup/.github/workflows/recreate-release.yml new file mode 100644 index 0000000000..bee6379d1c --- /dev/null +++ b/backup/.github/workflows/recreate-release.yml @@ -0,0 +1,27 @@ +name: Recreate Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build: + name: Recreate Release + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Recreate Release + uses: GongT/actions-recreate-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: latest + release_name: Release at ${{ github.ref }} + body: | + Changes in this Release + - First Change + - Second Change + draft: false + prerelease: false \ No newline at end of file diff --git a/backup/.github/workflows/release.yml b/backup/.github/workflows/release.yml new file mode 100644 index 0000000000..34e4b70d6b --- /dev/null +++ b/backup/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/backup/.github/workflows/replace-token.yml b/backup/.github/workflows/replace-token.yml new file mode 100644 index 0000000000..aaeca9d633 --- /dev/null +++ b/backup/.github/workflows/replace-token.yml @@ -0,0 +1,16 @@ +name: Replace Token + +on: [push, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: cat file.json + - uses: cschleiden/replace-tokens@v1 + with: + files: 'file.json' + env: + SECRET_TOKEN: ${{ secrets.SECRET_TEST }} + - run: cat file.json \ No newline at end of file diff --git a/backup/.github/workflows/replace-values-action.yml b/backup/.github/workflows/replace-values-action.yml new file mode 100644 index 0000000000..3d23e9943c --- /dev/null +++ b/backup/.github/workflows/replace-values-action.yml @@ -0,0 +1,17 @@ +name: Replace Values Action + +on: [push, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Replace multiple values in a specific file + uses: GuillaumeFalourd/replace-values-action@v1.1 + with: + file_path: ./file.json + parameters: | + #{SECRET_TOKEN}# >> SECRET_VALUE + blabla >> my_app_id + - run: cat ./file.json \ No newline at end of file diff --git a/backup/.github/workflows/repository-dispatch-triggered.yml b/backup/.github/workflows/repository-dispatch-triggered.yml new file mode 100644 index 0000000000..b0f2f54c83 --- /dev/null +++ b/backup/.github/workflows/repository-dispatch-triggered.yml @@ -0,0 +1,12 @@ +name: Repository Dispatch Triggered + +on: [repository_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Repository Dispatch Triggered + if: github.event.action == 'event-demo' + run: | + echo "Workflow triggered successfully by repository dispatch action!" \ No newline at end of file diff --git a/backup/.github/workflows/repository-dispatch.yml b/backup/.github/workflows/repository-dispatch.yml new file mode 100644 index 0000000000..47c20093ef --- /dev/null +++ b/backup/.github/workflows/repository-dispatch.yml @@ -0,0 +1,15 @@ +name: Repository Dispatch + +on: [push, workflow_dispatch] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v1.1.3 + with: + token: ${{ secrets.ACCESS_TOKEN }} + repository: GuillaumeFalourd/useful-actions + event-type: event-demo + client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' \ No newline at end of file diff --git a/backup/.github/workflows/retry-action.yml b/backup/.github/workflows/retry-action.yml new file mode 100644 index 0000000000..4873cc3c5e --- /dev/null +++ b/backup/.github/workflows/retry-action.yml @@ -0,0 +1,31 @@ +name: Retry Action + +on: + workflow_dispatch: + push: + tags: + - 'v*.*.*' + +jobs: + wandalen-retry: + runs-on: ubuntu-latest + steps: + - name : Retry action + uses : Wandalen/wretry.action@0.2.7 + with : + action : actions/setup-node@v1 + with : | + node-version : 16.x + attempt_limit : 3 + attempt_delay: 1000 + + # nick-fields-retry: + # runs-on: ubuntu-latest + # steps: + # - name : Retry action + # uses: nick-fields/retry@v2 + # with: + # timeout_seconds: 15 + # max_attempts: 3 + # retry_on: error + # command: npm run some-typically-fast-script diff --git a/backup/.github/workflows/set-secrets.yml b/backup/.github/workflows/set-secrets.yml new file mode 100644 index 0000000000..44dbc3acc2 --- /dev/null +++ b/backup/.github/workflows/set-secrets.yml @@ -0,0 +1,18 @@ +name: Set Secrets + +on: + workflow_dispatch: + +jobs: + job: + runs-on: ubuntu-18.04 + steps: + - uses: hmanzur/actions-set-secret@v2.0.0 + with: + name: 'MY_SECRET_NAME' + value: 'Lorem ipsun dolor simit' + repository: GuillaumeFalourd/useful-actions + token: ${{ secrets.ACCESS_TOKEN }} + + - name: "Echo Created Secret" + run: echo ${{ secrets.MY_SECRET_NAME }} \ No newline at end of file diff --git a/backup/.github/workflows/skip-duplicate.yml b/backup/.github/workflows/skip-duplicate.yml new file mode 100644 index 0000000000..51efeb449b --- /dev/null +++ b/backup/.github/workflows/skip-duplicate.yml @@ -0,0 +1,35 @@ +name: Skip Duplicate + +on: # rebuild any PRs and main branch changes + pull_request: + push: + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - uses: actions/checkout@v2.3.4 + - uses: ./ + id: skip_check + with: + concurrent_skipping: 'never' + # skip_after_successful_duplicate: 'true' + # paths_ignore: '["**/README.md", "**/docs/**"]' + # do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + cancel_others: true + + main_job_not_skipped: + needs: pre_job + if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + runs-on: ubuntu-latest + steps: + - run: echo "There is something to do here (not skipped)" + + main_job_skipped: + needs: pre_job + if: ${{ needs.pre_job.outputs.should_skip == 'true' }} + runs-on: ubuntu-latest + steps: + - run: echo "There is nothing to do here (skipped)" \ No newline at end of file diff --git a/backup/.github/workflows/stale.yml b/backup/.github/workflows/stale.yml new file mode 100644 index 0000000000..b5ae3828cd --- /dev/null +++ b/backup/.github/workflows/stale.yml @@ -0,0 +1,14 @@ +name: 'Stale' + +on: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + stale-issue-message: 'Message to comment on stale issues. If none provided, will not mark issues stale' + stale-pr-message: 'Message to comment on stale PRs. If none provided, will not mark PRs stale' \ No newline at end of file diff --git a/backup/.github/workflows/super-linter.yml b/backup/.github/workflows/super-linter.yml new file mode 100644 index 0000000000..e6321bc61d --- /dev/null +++ b/backup/.github/workflows/super-linter.yml @@ -0,0 +1,19 @@ +name: Super Linter + +on: [push, workflow_dispatch] + +jobs: + build: + name: Super Linter + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Lint Code Base + uses: github/super-linter@v4.9.2 + env: + VALIDATE_ALL_CODEBASE: false + DEFAULT_BRANCH: main + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/backup/.github/workflows/typos.yml b/backup/.github/workflows/typos.yml new file mode 100644 index 0000000000..09d13e9c8d --- /dev/null +++ b/backup/.github/workflows/typos.yml @@ -0,0 +1,26 @@ + +name: Typos + +on: [workflow_dispatch] + +jobs: + run: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v2 + + - name: Prepare file with mistakes. + run: echo "The quick brown foxx jumped over the slepy dog." > file.txt + - name: Test force pass with mistakes + uses: crate-ci/typos@v1.0.4 + with: + files: ./file.txt + + - name: Prepare file with no mistakes. + run: echo "The quick brown fox jumped over the sleepy dog." > file.txt + - name: Test force pass with no mistakes + uses: crate-ci/typos@v1.0.4 + with: + files: ./file.txt \ No newline at end of file diff --git a/backup/.github/workflows/upload-download-artifacts.yml b/backup/.github/workflows/upload-download-artifacts.yml new file mode 100644 index 0000000000..6ac40a9653 --- /dev/null +++ b/backup/.github/workflows/upload-download-artifacts.yml @@ -0,0 +1,53 @@ +name: Upload & Download Artifacts + +on: [push, workflow_dispatch] + + +jobs: + + job_1: + name: Add 3 and 7 + runs-on: ubuntu-latest + steps: + - shell: bash + run: | + expr 3 + 7 > math-homework.txt + - name: Upload math result for job 1 + uses: actions/upload-artifact@v4.4.0 + with: + name: homework + path: math-homework.txt + + job_2: + name: Multiply by 9 + needs: job_1 + runs-on: windows-latest + steps: + - name: Download math result for job 1 + uses: actions/download-artifact@v4.1.8 + with: + name: homework + - shell: bash + run: | + value=`cat math-homework.txt` + expr $value \* 9 > math-homework.txt + - name: Upload math result for job 2 + uses: actions/upload-artifact@v4.4.0 + with: + name: homework + path: math-homework.txt + + job_3: + name: Display results + needs: job_2 + runs-on: macOS-latest + steps: + - name: Download math result for job 2 + uses: actions/download-artifact@v4.1.8 + with: + name: homework + - name: Print the final result + shell: bash + run: | + value=`cat math-homework.txt` + echo The result is $value \ No newline at end of file diff --git a/backup/.github/workflows/wait-on-check.yml b/backup/.github/workflows/wait-on-check.yml new file mode 100644 index 0000000000..40c63a4106 --- /dev/null +++ b/backup/.github/workflows/wait-on-check.yml @@ -0,0 +1,25 @@ +name: Wait on Check + +on: + push: + +jobs: + wait-on-check: + name: Wait on check + runs-on: ubuntu-latest + steps: + - name: Wait for Multiply by 9 job (Upload & Download Artifacts workflow) to succeed + uses: lewagon/wait-on-check-action@v1.1.1 + with: + ref: main + check-name: 'Multiply by 9' + repo-token: ${{ secrets.GITHUB_TOKEN }} + wait-interval: 5 + + after-wait-on-check: + name: After wait on check + needs: + - wait-on-check + runs-on: ubuntu-latest + steps: + - run: echo "Will run after other workflows or jobs finished." \ No newline at end of file diff --git a/backup/.github/workflows/workflow-dispatch-triggerred.yml b/backup/.github/workflows/workflow-dispatch-triggerred.yml new file mode 100644 index 0000000000..961ef1046f --- /dev/null +++ b/backup/.github/workflows/workflow-dispatch-triggerred.yml @@ -0,0 +1,19 @@ +name: Workflow Dispatch Triggered + +on: + workflow_dispatch: + inputs: + input: + description: "Test" + required: false + default: "World" + repository_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Repository Dispatch Triggered + run: | + echo "Workflow triggered successfully by workflow dispatch action!" + echo Hello ${{ github.event.inputs.input }} diff --git a/backup/.github/workflows/workflow-dispatch.yml b/backup/.github/workflows/workflow-dispatch.yml new file mode 100644 index 0000000000..7ae9750735 --- /dev/null +++ b/backup/.github/workflows/workflow-dispatch.yml @@ -0,0 +1,35 @@ + +name: Workflow Dispatch + +on: [workflow_dispatch] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - name: Invoke workflow without inputs + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: 'Workflow Dispatch Triggered' + token: ${{ secrets.ACCESS_TOKEN }} + + job2: + runs-on: ubuntu-latest + steps: + - name: Invoke workflow with inputs + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: 'Workflow Dispatch Triggered' + token: ${{ secrets.ACCESS_TOKEN }} + inputs: '{ "input": "You" }' + + job3: + runs-on: ubuntu-latest + steps: + - name: Invoke workflow in another repo with inputs + uses: benc-uk/workflow-dispatch@v1 + with: + workflow: '00 - Workflow Dispatch' + repo: GuillaumeFalourd/poc-github-actions + token: ${{ secrets.ACCESS_TOKEN }} + inputs: '{ "input": "You" }' diff --git a/backup/CODE_OF_CONDUCT.md b/backup/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..11482d75fa --- /dev/null +++ b/backup/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at [ritchie@zup.com.br](ritchie@zup.com.br). All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +[https://www.contributor-covenant.org/faq](https://www.contributor-covenant.org/faq) diff --git a/backup/CONTRIBUTING.md b/backup/CONTRIBUTING.md new file mode 100644 index 0000000000..be9c8fe9b1 --- /dev/null +++ b/backup/CONTRIBUTING.md @@ -0,0 +1,22 @@ +# Contribution + +You're welcome to add useful actions to the repository + +## New contents for the project + +**Always** base your work on the project's `main` branch, naming your new branch +according to the following guide: + +![branchs](/git-branchs.png) + +**Examples: `feature/new-action-name` or `fix/action-name`** + +## Guidelines + +- Contents should be written in English. + +- Add new actions on the [Global Actions section](https://github.com/GuillaumeFalourd/useful-actions#-global-actions), the [Docker Actions section](https://github.com/GuillaumeFalourd/useful-actions#-docker-actions) or on the [Other Tools Actions section](https://github.com/GuillaumeFalourd/useful-actions#-other-tools-actions) on the main README file (respect an `alphabetical` order). + +- New actions should be associated to a workflow example on the `.github/workflows` directory of the [Useful Actions](https://github.com/GuillaumeFalourd/useful-actions) repository, based on the official action repository examples. + +_Observation: If the action can be triggered through a `workflow_dispatch` event, please add it to the trigger options on the workflow implementation. It will make tests easier._ diff --git a/backup/Dockerfile b/backup/Dockerfile new file mode 100644 index 0000000000..ed84390096 --- /dev/null +++ b/backup/Dockerfile @@ -0,0 +1,7 @@ +FROM alpine:3.10 + +# WORKFLOW TEST + +RUN apk add --no-cache curl==7.66.0-r4 +RUN apk add --no-cache bash==5.0.0-r0 +RUN apk add --no-cache make==4.2.1-r2 \ No newline at end of file diff --git a/backup/LICENSE b/backup/LICENSE new file mode 100644 index 0000000000..dd2b7db635 --- /dev/null +++ b/backup/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2021 Guillaume Falourd + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/backup/README.md b/backup/README.md new file mode 100644 index 0000000000..208e10dbe0 --- /dev/null +++ b/backup/README.md @@ -0,0 +1,335 @@ +# useful-actions + +![title](/useful-github-actions.png) + +This repository lists some useful generic Actions to use in your Github workflows and repositories. + +## Summary + +- [Good to Know](https://github.com/GuillaumeFalourd/useful-actions#-good-to-know) +- [Useful Actions](https://github.com/GuillaumeFalourd/useful-actions#-useful-actions) + - [Global Actions](https://github.com/GuillaumeFalourd/useful-actions#-global-actions) + - [Docker Actions](https://github.com/GuillaumeFalourd/useful-actions#-docker-actions) + - [Other Tools Actions](https://github.com/GuillaumeFalourd/useful-actions#-other-tools-actions) +- [How to create new actions](https://github.com/GuillaumeFalourd/useful-actions#-how-to-create-new-actions) +- [How to debug workflows](https://github.com/GuillaumeFalourd/useful-actions#%EF%B8%8F-how-to-debug-workflows) +- [How to test actions locally](https://github.com/GuillaumeFalourd/useful-actions#-how-to-test-actions-locally) +- [Contribution](CONTRIBUTING.md) + +*** + +## 💡 Good To Know + +- [Usage Limits](https://docs.github.com/en/actions/reference/usage-limits-billing-and-administration) +- [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions) +- [Authentication in a workflow](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) +- [Creating a personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) + +*** + +## 🔎 Useful Actions + +*** + +## 🌐 Global Actions + +[![Action Cond](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/action-cond.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/action-cond.yml) + +[Action Cond](https://github.com/marketplace/actions/conditional-value-for-github-action): GitHub Action to use a `if-else` operation when needed, to set dynamic configuration of other steps. + +[![Add Label](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/add-label.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/add-label.yml) + +[Add Label](https://github.com/marketplace/actions/actions-ecosystem-add-labels): GitHub Action to add GitHub labels to an issue or a pull request. + +[![Add Reviewers](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/add-reviewers.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/add-reviewers.yml) + +[Add Reviewers](https://github.com/marketplace/actions/add-reviewers): Github action that adds Reviewers to the Pull Request. + +[![App Token](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/app-token.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/app-token.yml) + +[App Token](https://github.com/marketplace/actions/github-app-token): Github Action to impersonate a GitHub App when `secrets.GITHUB_TOKEN`'s limitations are too restrictive and a personal access token is not suitable. + +[![Assert command line output](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/assert-command-line-output.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/assert-command-line-output.yml) + +[Assert command line output](https://github.com/marketplace/actions/assert-command-line-output): Github Action to assert / check a command line output. + +[![Auto Accept Collabs](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-accept-collabs.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-accept-collabs.yml) + +[Auto Accept Collabs](https://github.com/marketplace/actions/auto-accept-collabs): Github Action to accept automatically all collaboration invites. Useful for a bot account. + +[![Auto approve](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-approve.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-approve.yml) + +[Auto Approve](https://github.com/marketplace/actions/auto-approve): Github Action to automatically approve pull requests. + +[![Auto Assign](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-assign.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-assign.yml) + +[Auto Assign](https://github.com/marketplace/actions/auto-assign-action): Github Action to add reviewers and assignees to a pull request when opened (needs [auto_assign.yml](https://github.com/GuillaumeFalourd/useful-actions/actions/auto_assign.yml) configuration file). + +[![Auto Assign Author](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-assign-author.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-assign-author.yml) + +[Auto Assign Author](https://github.com/marketplace/actions/auto-author-assign): Github Action to automatically assigns PR author as an assignee. + +[![Auto merge](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-merge.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/auto-merge.yml) + +[Auto Merge](https://github.com/marketplace/actions/merge-pull-requests): GitHub Action to automatically merge pull requests when they are ready (`automerged` label). + +[![Branch Names](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/branch-names.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/branch-names.yml) + +[Branch Names](https://github.com/marketplace/actions/branch-names): Github Action to get branch or tag information without the `/ref/*` prefix. + +[![Cache](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/cache.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/cache.yml) + +[Cache](https://github.com/marketplace/actions/cache): Github Action to cache dependencies and build outputs to improve workflow execution time. + +[![Cancel Workflow](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/cancel-workflow.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/cancel-workflow.yml) + +[Cancel Workflow](https://github.com/marketplace/actions/cancel-workflow-action): Github Action cancel any previous runs that are not `completed` for a given workflow. This includes runs with a status of `queued` or `in_progress`. + +[![Changed Files](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/changed-files.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/changed-files.yml) + +[Changed Files](https://github.com/marketplace/actions/changed-files): Github Action to retrieve all changed files relative to the default branch (`pull_request*` based events) or the last remote commit (`push` based event) returning the **absolute path** to all changed files from the project root. + +[![Checkout](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/checkout.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/checkout.yml) + +[Checkout](https://github.com/marketplace/actions/checkout): Github Action to checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it. + +[![Close Pull Request](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/close-pull-request.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/close-pull-request.yml) + +[Close Pull Request](https://github.com/marketplace/actions/close-pull-request): Github Action to automatically close a pull request (for example if modifying _untouchable files_). + +[![Commit And Push](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/commit-and-push.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/commit-and-push.yml) + +[Commit And Push](https://github.com/marketplace/actions/git-commit-and-push): Github Action to commit and push new code to the repository. + +[![Compress Images](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/compress-image.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/compress-image.yml) + +[Compress Images](https://github.com/marketplace/actions/image-actions): Github Action to automatically compresses JPEGs, PNGs and WebPs in Pull Requests. + +[![Copycat](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/copycat.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/copycat.yml) + +[Copycat](https://github.com/marketplace/actions/copycat-action): GitHub Action to copy files from your repository to another external repository. It is also possible to copy files from/to repository Wikis. + +[![Create JSON](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/create-json.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/create-json.yml) + +[Create JSON](https://github.com/marketplace/actions/create-json): GitHub Action to create a .json file dynamically on your workflow. + +[![Create Pull Request](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/create-pull-request.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/create-pull-request.yml) + +[Create Pull Request](https://github.com/marketplace/actions/create-pull-request): GitHub Action to create a pull request for changes to your repository in the actions workspace. + +[![Curl](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/curl.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/curl.yml) + +[Curl](https://github.com/marketplace/actions/github-action-for-curl): GitHub Action to use the curl CLI to perform http requests. + +[![Debug](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/debug.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/debug.yml) + +[Debug](https://github.com/marketplace/actions/debug-action): GitHub Action to print the environment variables and the event payload. Useful for developing or debugging GitHub Actions. + +[![Delete Artifacts](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/delete-artifact.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/delete-artifact.yml) + +[Delete Artifacts](https://github.com/marketplace/actions/delete-artifact): GitHub Action to delete artifacts within a workflow run. This can be useful when artifacts are shared across jobs, but are no longer needed when the workflow is complete. + +[![Enforce PR labels](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/enforce-labels.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/enforce-labels.yml) + +[Enforce PR labels](https://github.com/marketplace/actions/enforce-pr-labels): GitHub Action to enforce assigning labels before merging PR's. Useful for generating automatic changelog and release notes with `github-release-notes`. + +[![Env Vars](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/env-vars.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/env-vars.yml) + +[Env Vars](https://github.com/marketplace/actions/github-environment-variables-action): GitHub Action to expose useful environment variables. + +[![File Existence](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/file-existence.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/file-existence.yml) + +[File Existence](https://github.com/marketplace/actions/file-existence): Github Action to check if files exists or not. + +[![First Interaction](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/first-interaction.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/first-interaction.yml) + +[First Interaction](https://github.com/marketplace/actions/first-interaction): Github Action to filter pull requests and issues from first-time contributors. + +[![Get Workflow Origin](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/get-workflow-origin.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/get-workflow-origin.yml) [![Get Workflow Origin Information](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/get-workflow-origin-run.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/get-workflow-origin-run.yml) + +[Get Workflow Origin](https://github.com/potiuk/get-workflow-origin): Github Action to provide information about the pull requests that triggered the workflow for the `pull_request` and `pull_request_review` events or for the `workflow_run` event that is triggered by one of those events. + +[![GHAction Dump Context](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/ghaction-dump-context.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/ghaction-dump-context.yml) + +[GHAction Dump Context](https://github.com/marketplace/actions/dump-context): GitHub Action to dump context of your workflow (which allows to check all variables available using the `github.event` syntax in the workflow). + +[![GHAction Github Status](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/ghaction-github-status.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/ghaction-github-status.yml) + +[GHAction Github Status](https://github.com/marketplace/actions/github-status): GitHub Action to check [GitHub Status](https://www.githubstatus.com/) in workflows, allowinf to trigger error if GitHub services are down. + +[![Git Auto Commit](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/git-auto-commit.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/git-auto-commit.yml) + +[Git Auto Commit](https://github.com/marketplace/actions/git-auto-commit): GitHub Action to detect changed files during a Workflow run and to commit and push them back to the GitHub repository. By default, the commit is made in the name of "GitHub Actions" and co-authored by the user that made the last commit. + +[![Github Environment Variables](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/github-environment-variables.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/github-environment-variables.yml) + +[Github Environment Variables](https://github.com/marketplace/actions/github-environment-variables-action): GitHub Action to expose useful environment variables. + +[![Github Script](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/github-script.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/github-script.yml) + +[Github Script](https://github.com/marketplace/actions/github-script): Github Action to make it easy to quickly write a script in your workflow that uses the GitHub API and the workflow run context. + +[![Gitleaks](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/gitleaks.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/gitleaks.yml) + +[Gitleaks](https://github.com/marketplace/actions/gitleaks): Github Action to detect hardcoded secrets like passwords, api keys, and tokens in git repos. + +[![GPT Review](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/gpt-review.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/gpt-review.yml) + +[GPT Review](https://github.com/marketplace/actions/chat-gpt-code-peer-review): Github Action enabling automatic code reviewing in your repository by sending the git diff patches between a head ref and a base ref to OpenAI's API for annotation using Chat GPT (needs [OpenAi API Key](https://www.maisieai.com/help/how-to-get-an-openai-api-key-for-chatgpt)). + +[![Horusec](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/horusec.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/horusec.yml) + +[Horusec](https://github.com/marketplace/actions/horusec): Github Action to identify vulnerabilities in your project. + +[![Manual Approval](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/manual-approval.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/manual-approval.yml) + +[Manual Approval](https://github.com/marketplace/actions/manual-workflow-approval): Github Action to pause a workflow and require manual approval from **one or more** approvers before continuing. + +[![Paths Filter](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/paths-filter.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/paths-filter.yml) + +[Paths Filter](https://github.com/marketplace/actions/paths-changes-filter): Github Action that enables conditional execution of workflow steps and jobs, based on the files modified by pull request, on a feature branch, or by the recently pushed commits. + +[![Pull Request](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/pull-request.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/pull-request.yml) + +[Pull Request](https://github.com/marketplace/actions/github-pull-request-action): GitHub Action to create pull requests automatically. + +[![Purge Artifacts](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/purge-artifacts.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/purge-artifacts.yml) + +[Purge Artifacts](https://github.com/marketplace/actions/purge-artifacts): Github Action responsible for deleting old artifacts by setting expire duration. + +[![Read File](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/read-file.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/read-file.yml) + +[Read File](https://github.com/marketplace/actions/read-file): Github Action to read file contents. + +[![Recreate Release](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/recreate-release.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/recreate-release.yml) + +[Recreate Release](https://github.com/GongT/actions-recreate-release): Github Action to delete previous release by `tag_name` or `release_name` and then call `actions/create-release` to create it again. + +[![Release](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/release.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/release.yml) + +[Release](https://github.com/marketplace/actions/gh-release): GitHub Action for creating GitHub Releases on Linux, Windows, and macOS virtual environments. + +[![Replace Token](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/replace-token.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/replace-token.yml) + +[Replace Token](https://github.com/marketplace/actions/replace-tokens): GitHub Action for replacing tokens in files. + +[![Replace Values Action](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/replace-values-action.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/replace-values-action.yml): Github Action to replace values in files (secrets or fields). + +[![Repository-Dispatch](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/repository-dispatch.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/repository-dispatch.yml) [![Repository-Dispatch-Triggered](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/repository-dispatch-triggered.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/repository-dispatch-triggered.yml) + +[Repository-Dispatch](https://github.com/marketplace/actions/repository-dispatch): GitHub Action to create a repository dispatch event. + +[![Retry Action](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/retry-action.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/retry-action.yml) + +[Retry Action](https://github.com/marketplace/actions/retry-action): GitHub Action to rerun another GitHub Actions and commands. + +[![Set Secrets](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/set-secrets.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/set-secrets.yml) + +[Set Secrets](https://github.com/marketplace/actions/set-action-secret): Github Action to Create or edit actions secrets in repository or organizations. + +Example + +[![Skip duplicate](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/skip-duplicate.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/skip-duplicate.yml) + +[Skip duplicate](https://github.com/marketplace/actions/skip-duplicate-actions): GitHub Action to skip duplicate workflow-runs (after merges, pull requests or similar), skip concurrent or parallel workflow-runs for things that you do not want to run twice, skip ignored paths to speedup documentation-changes or similar, skip if paths not changed for something like directory-specific tests, cancel outdated workflow-runs after branch-pushes. + +[![Stale](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/stale.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/stale.yml) + +[Stale](https://github.com/marketplace/actions/close-stale-issues): GitHub Action to warn and then close issues and PRs that have had no activity for a specified amount of time. + +[![Super Linter](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/super-linter.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/super-linter.yml) + +[Super Linter](https://github.com/marketplace/actions/super-linter): Github Action to help validate your source code. + +[![Upload & Download Artifacts](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/upload-download-artifacts.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/upload-download-artifacts.yml) + +[Upload Artifact](https://github.com/marketplace/actions/upload-a-build-artifact): Github Action to share data between jobs and store data once a workflow is complete ([example](https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow)). + +[Download Artifact](https://github.com/marketplace/actions/download-a-build-artifact): Github Action to download artifacts from your build ([example](https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#passing-data-between-jobs-in-a-workflow)). + +[![Wait on check](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/wait-on-check.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/wait-on-check.yml) + +[Wait on check](https://github.com/marketplace/actions/wait-on-check): Github Action to pause a workflow until a job in another workflow completes successfully. + +[![Workflow Dispatch](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/workflow-dispatch.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/workflow-dispatch.yml) [![Workflow Dispatch Triggered](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/workflow-dispatch-triggerred.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/workflow-dispatch-triggerred.yml) + +[Workflow Dispatch](https://github.com/marketplace/actions/workflow-dispatch): Github Action to trigger another GitHub Actions workflow, using the `workflow_dispatch` event. The workflow must be configured for this event type `e.g. on: [workflow_dispatch]`. This allows you to chain workflows, the classic use case is have a CI build workflow, trigger a CD release/deploy workflow when it completes. Allowing you to maintain separate workflows for CI and CD, and pass data between them as required. + +*** + +## 🐳 Docker Actions + +[![GHAction Container Scan](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/ghaction-container-scan.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/ghaction-container-scan.yml) + +[GHAction Container Scan](https://github.com/marketplace/actions/container-scan): GitHub Action to check for vulnerabilities in a container image with [Trivy](https://github.com/aquasecurity/trivy). + +[![Hadolint](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/hadolint.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/hadolint.yml) + +[Hadolint](https://github.com/burdzwastaken/hadolint-action): Github Action to run Hadolint and reports violations given a Dockerfile within a repository on a pull request. + +[![Phonito](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/phonito.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/phonito.yml) + +[Phonito](https://github.com/marketplace/actions/docker-vulnerability-scan-with-phonito-security): Github Action to automate scanning Docker images for OS & library vulnerabilities. Need a free Phonito Security account at [https://phonito.io](https://phonito.io). + +[![Publish Docker](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/publish-docker.yml/badge.svg)](https://github.com/GuillaumeFalourd/useful-actions/actions/workflows/publish-docker.yml) + +[Publish Docker](https://github.com/marketplace/actions/publish-docker): Github Action to build and push containers. + +## 🦾 Other Tools Actions + +_TODO_ + +*** + +## 🧐 How to create new actions + +The [Github tutorial](https://docs.github.com/en/actions/creating-actions) is great to understand how to create: + +- [Docker Container Actions](https://docs.github.com/en/actions/creating-actions/creating-a-docker-container-action) +- [Javascript Actions](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action) +- [Composite Run Steps Actions](https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action) + +*** + +## 🕵️ How to debug workflows + +The [action-upterm](https://github.com/lhotari/action-upterm) uses [upterm](https://upterm.dev/) and [tmux](https://github.com/tmux/tmux/wiki) to offer a direct way to interact with the host system on which the actual actions will run. + +By using this minimal example a upterm session will be created. + +```yaml +name: CI +on: [push] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup upterm session + uses: lhotari/action-upterm@v1 +``` + +To get the `ssh` connection string, just open the workflow `Checks` tab and scroll to the bottom. + +_Note: If you want to continue a workflow and you are inside a upterm session, just create a empty file with the name `continue` either in the root directory or in the workspace directory by running `touch continue` or `sudo touch /continue`. Closing the terminal will also continue the workflow. However you won't be able to reconnect in that case. It's possible to detach from the terminal and not continue by first pressing C-b and then d (tmux detach command keys)._ + +*** + +## 🤖 How to test actions locally + +This tool can be used to test actions locally: [Act](https://github.com/nektos/act) + +Screenshot + +*** + +## 🤝 Contribution + +Would like to contribute to the repository? Here are the [guidelines](CONTRIBUTING.md) 🚀 + + + + + + +(Made with [contributors-img](https://contrib.rocks)) diff --git a/backup/assert.txt b/backup/assert.txt new file mode 100644 index 0000000000..39b1701819 --- /dev/null +++ b/backup/assert.txt @@ -0,0 +1,15 @@ +total 440 +drwxr-xr-x 14 runner docker 448B Nov 29 10:06 . +drwxr-xr-x 88 runner docker 2.8K Nov 25 18:51 .. +drwxr-xr-x 15 runner docker 480B Nov 29 10:06 .git +drwxr-xr-x 4 runner docker 128B Jul 6 11:48 .github +-rw-r--r-- 1 runner docker 3.4K Apr 8 2021 CODE_OF_CONDUCT.md +-rw-r--r-- 1 runner docker 1.0K Nov 19 09:39 CONTRIBUTING.md +-rw-r--r-- 1 runner docker 149B May 27 2021 Dockerfile +-rw-r--r-- 1 runner docker 11K Apr 8 2021 LICENSE +-rw-r--r-- 1 runner docker 17K Nov 19 09:39 README.md +-rw-r--r-- 1 runner docker 29B Nov 29 10:06 checkout-workflow.txt +-rw-r--r-- 1 runner docker 29B Nov 19 09:39 commit-and-push-workflow.txt +-rw-r--r-- 1 runner docker 27K Apr 8 2021 git-branchs.png +-rw-r--r-- 1 runner docker 29B Nov 29 10:06 pull-request-workflow.txt +-rw-r--r-- 1 runner docker 132K Jun 22 15:46 useful-github-actions.png \ No newline at end of file diff --git a/backup/checkout-workflow.txt b/backup/checkout-workflow.txt new file mode 100644 index 0000000000..965dd053f5 --- /dev/null +++ b/backup/checkout-workflow.txt @@ -0,0 +1 @@ +Mon Jan 27 01:39:48 UTC 2025 diff --git a/backup/commit-and-push-workflow.txt b/backup/commit-and-push-workflow.txt new file mode 100644 index 0000000000..6c56870196 --- /dev/null +++ b/backup/commit-and-push-workflow.txt @@ -0,0 +1 @@ +Wed Sep 4 11:16:09 UTC 2024 diff --git a/backup/file.json b/backup/file.json new file mode 100644 index 0000000000..8914425d77 --- /dev/null +++ b/backup/file.json @@ -0,0 +1,4 @@ +{ + "secret_token": "#{SECRET_TOKEN}#", + "apiId": "blabla" +} \ No newline at end of file diff --git a/backup/git-auto-commit-workflow.txt b/backup/git-auto-commit-workflow.txt new file mode 100644 index 0000000000..6b3505ec52 --- /dev/null +++ b/backup/git-auto-commit-workflow.txt @@ -0,0 +1 @@ +Wed Sep 4 11:15:37 UTC 2024 diff --git a/backup/git-branchs.png b/backup/git-branchs.png new file mode 100644 index 0000000000..2380aac5c6 Binary files /dev/null and b/backup/git-branchs.png differ diff --git a/backup/horusec-config.json b/backup/horusec-config.json new file mode 100644 index 0000000000..a5ef302fb4 --- /dev/null +++ b/backup/horusec-config.json @@ -0,0 +1,3 @@ +{ + "horusecCliRiskAcceptHashes": ["2c9ed8f3c58de0cc0eb1ce8ac3d5d88f088eccd69938f4136de73600be6538ec"] +} diff --git a/backup/pull-request-workflow.txt b/backup/pull-request-workflow.txt new file mode 100644 index 0000000000..a8bb692dae --- /dev/null +++ b/backup/pull-request-workflow.txt @@ -0,0 +1 @@ +Fri Jan 24 06:29:18 UTC 2025 diff --git a/backup/useful-github-actions.png b/backup/useful-github-actions.png new file mode 100644 index 0000000000..c30fbcb5f2 Binary files /dev/null and b/backup/useful-github-actions.png differ diff --git a/crontab b/crontab new file mode 100644 index 0000000000..43774b863c --- /dev/null +++ b/crontab @@ -0,0 +1,5 @@ +46 1 * * * curl -Ssi -X GET https://www.zup.com.br/ +0 1 1 * * curl -Ssi -X GET https://www.zup.com.br/ +0 0 * * MON-FRI curl -Ssi -X GET https://www.zup.com.br/ + + diff --git a/folder1/test.txt b/folder1/test.txt new file mode 100644 index 0000000000..25bf17fc5a --- /dev/null +++ b/folder1/test.txt @@ -0,0 +1 @@ +18 \ No newline at end of file diff --git a/folder2/test.txt b/folder2/test.txt new file mode 100644 index 0000000000..8e2afd3427 --- /dev/null +++ b/folder2/test.txt @@ -0,0 +1 @@ +17 \ No newline at end of file diff --git a/gcp/test.md b/gcp/test.md new file mode 100644 index 0000000000..a6947df6fc --- /dev/null +++ b/gcp/test.md @@ -0,0 +1,2 @@ +Related to https://stackoverflow.com/questions/72704563/github-action-echo-within-an-expression +In workflow-tester41.yml \ No newline at end of file diff --git a/new-output.py b/new-output.py new file mode 100644 index 0000000000..b64e6e34ed --- /dev/null +++ b/new-output.py @@ -0,0 +1,12 @@ +import os + +env_file = os.getenv('GITHUB_ENV') +output_file = os.getenv('GITHUB_OUTPUT') + +hello='hello' + +with open(env_file, "a") as myfile: + myfile.write(f"TEST={hello}") + +with open(output_file, "a") as myfile: + myfile.write(f"TEST={hello}") \ No newline at end of file diff --git a/output_function.py b/output_function.py new file mode 100644 index 0000000000..ed6deabbf0 --- /dev/null +++ b/output_function.py @@ -0,0 +1,9 @@ +import os + +def save_output(name: str, value: str): + with open(os.environ['GITHUB_OUTPUT'], 'a') as output_file: + print(f'{name}={value}', file=output_file) + +save_output('TEST1', 'VALUE1') +save_output('TEST2', 'VALUE2') +save_output('TEST3', 'VALUE3') \ No newline at end of file diff --git a/report.txt b/report.txt index 6154de96b8..e595f8f742 100644 --- a/report.txt +++ b/report.txt @@ -1 +1 @@ -Wed Sep 8 02:26:06 UTC 2021 +Tue Oct 25 07:02:44 UTC 2022 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..663bd1f6a2 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +requests \ No newline at end of file diff --git a/script.groovy b/script.groovy new file mode 100644 index 0000000000..f438df031b --- /dev/null +++ b/script.groovy @@ -0,0 +1,25 @@ +#!/usr/bin/env groovy + +import groovy.json.JsonSlurper + +// Read the JSON file +def jsonFile = new File('Config.json') +def jsonSlurper = new JsonSlurper() +def configs = jsonSlurper.parse(jsonFile) + +// Calculate the total number of bundles +def totalBundles = configs.bundles.size() +println "Total Array Size = " + totalBundles + +// Initialize an array for product names +def productName = new Object[totalBundles] + +// Example to fill the array (assuming 'bundles' contains objects with a 'name' property) +configs.bundles.eachWithIndex { bundle, index -> + productName[index] = bundle.product.name +} + +// Print the product names +productName.each { name -> + println "Product Name: " + name +} \ No newline at end of file diff --git a/scripts/list-output.py b/scripts/list-output.py new file mode 100644 index 0000000000..1c911e433c --- /dev/null +++ b/scripts/list-output.py @@ -0,0 +1,23 @@ +import os + +env_file = os.getenv('GITHUB_ENV') +output_file = os.getenv('GITHUB_OUTPUT') + +allRepos = [ + {"name":"repo1"}, + {"name":"repo2"}, + {"name":"repo3"}, +] + +allRepoNames=[] + +for repo in allRepos: + allRepoNames.append(repo['name']) + allRepoNamesList = ','.join(allRepoNames) + print("List:", allRepoNamesList) + +with open(env_file, "a") as myfile: + myfile.write(f"TEST={allRepoNamesList}") + +with open(output_file, "a") as myfile: + myfile.write(f"TEST={allRepoNamesList}") \ No newline at end of file diff --git a/scripts/list-output2.py b/scripts/list-output2.py new file mode 100644 index 0000000000..f9bbf2fb73 --- /dev/null +++ b/scripts/list-output2.py @@ -0,0 +1,43 @@ +import os +import urllib2 +import json + +repoResultsPerPage=100 +repoPageNumber=1 +gitHubOrganization='${{ inputs.organization }}' +token='${{ inputs.token }}' +allRepos = [] +allRepoNames = [] +allRepoNamesList = '' +output_file = os.getenv('GITHUB_OUTPUT') + +# URL to send the request to +url = '/api/v3/orgs/%s/repos?page=%s&per_page=%s' % (gitHubOrganization, repoPageNumber, repoResultsPerPage) + +# Custom headers to include in the request +headers = {'content-type': 'application/json', 'Authorization': 'token %s' % (token)} + +# Create a Request object with the URL and headers +req = urllib2.Request(url, headers=headers) + +# Send the request and store the response in a variable +response = urllib2.urlopen(req) + +# Read the response data +result = response.read() +while result != '[]': + print('PageNumber: %s' % (repoPageNumber)) + # Parse json + json_data = json.loads(result) + allRepos = allRepos + json_data + repoPageNumber = repoPageNumber + 1 + url = 'api/v3/orgs/%s/repos?page=%s&per_page=%s' % (gitHubOrganization, repoPageNumber, repoResultsPerPage) + req = urllib2.Request(url, headers=headers) + response = urllib2.urlopen(req) + result = response.read() +for repo in allRepos: + allRepoNames.append(repo['name']) + allRepoNamesList = ','.join(allRepoNames) + print("List:", allRepoNamesList) + with open(output_file, "a") as myfile: + myfile.write(f"TEST={allRepoNamesList}") \ No newline at end of file diff --git a/scripts/test.yaml b/scripts/test.yaml new file mode 100644 index 0000000000..e69de29bb2 diff --git a/scripts/test_workflow24.js b/scripts/test_workflow24.js new file mode 100644 index 0000000000..1dd98bcb01 --- /dev/null +++ b/scripts/test_workflow24.js @@ -0,0 +1 @@ +console.log("https://www.google.com"); \ No newline at end of file diff --git a/scripts/test_workflow24.py b/scripts/test_workflow24.py new file mode 100644 index 0000000000..f080ea7ffe --- /dev/null +++ b/scripts/test_workflow24.py @@ -0,0 +1 @@ +print("https://www.google.com") diff --git a/scripts/test_workflow25.js b/scripts/test_workflow25.js new file mode 100644 index 0000000000..48b8d1c9a7 --- /dev/null +++ b/scripts/test_workflow25.js @@ -0,0 +1,11 @@ +async function getData(){ + const url = [ + "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/Tyrannosaurus_rex_Sue_at_FMNH.jpg/440px-Tyrannosaurus_rex_Sue_at_FMNH.jpg", + "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Mosasaurus_beaugei_34.JPG/440px-Mosasaurus_beaugei_34.JPG" + ] + return url; + } + + getData().then((url) => { + console.log(url); + }); \ No newline at end of file diff --git a/scripts/test_workflow26.go b/scripts/test_workflow26.go new file mode 100644 index 0000000000..cee83bc64b --- /dev/null +++ b/scripts/test_workflow26.go @@ -0,0 +1,16 @@ +// First Go program +package main + +import "fmt" + +// Main function +func main() { + SetTag("1.4.1") +} + +func SetTag(value string) { + fmt.Printf(`::set-output name=repo_tag::%s`, value) + fmt.Print("\n") + fmt.Printf(`::set-output name=ecr_tag::%s`, "v"+value) + fmt.Print("\n") +} diff --git a/scripts/test_workflow28.sh b/scripts/test_workflow28.sh new file mode 100644 index 0000000000..db7dc51d7a --- /dev/null +++ b/scripts/test_workflow28.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "jira_ticket_exists=false" >> $GITHUB_ENV diff --git a/shell.py b/shell.py new file mode 100644 index 0000000000..f67ab9a59d --- /dev/null +++ b/shell.py @@ -0,0 +1,5 @@ +import subprocess + +result = subprocess.check_output("c:\\windows\\system32\\wbem\\wmic.exe csproduct get uuid", shell=False).strip().decode().split("\n")[1] #nosec + +print(result) \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000000..3bd72f81e4 --- /dev/null +++ b/test.py @@ -0,0 +1,8 @@ +import json +from importlib import reload +import hashlib +from logging import raiseExceptions +import os +import importlib + +#placeholder1 \ No newline at end of file