-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (53 loc) · 1.8 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: 'Hello'
on:
push:
workflow_dispatch:
inputs:
who:
description: 'Test Workflow'
required: true
type: string
message:
description: 'Commit Message'
required: true
type: string
jobs:
hello_world_job:
runs-on: ubuntu-latest
name: A job to say hello
steps:
- uses: actions/checkout@v4
- id: foo
uses: MohammedSentry/hello-world-composite-action@v2
with:
who-to-greet: ${{ inputs.who || 'Mona the Octocat'}}
- run: echo random-number "$RANDOM_NUMBER"
shell: bash
env:
RANDOM_NUMBER: ${{ steps.foo.outputs.random-number }}
- name: Checkout the source repository
uses: actions/checkout@v4
with:
repository: MohammedSentry/hello-world-composite-action
ref: main # Spécifiez explicitement la branche, par exemple 'main' ou 'master'
path: source-repo
token: ${{ secrets.PAT_TOKEN }}
- name: Copy files to the download directory
run: |
mkdir -p download
cp -R source-repo/* download/
- name: Remove source repository
run: rm -rf source-repo
- name: Commit and push files
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add download/
if [ -z "${{ inputs.message }}" ]; then
echo "Commit message is empty. Aborting commit."
exit 1
fi
git commit -m "${{ inputs.message }}"
git push https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/MohammedSentry/test-workflow.git HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}