File tree Expand file tree Collapse file tree 8 files changed +204
-0
lines changed Expand file tree Collapse file tree 8 files changed +204
-0
lines changed Original file line number Diff line number Diff line change 1+ # Container image that runs your code
2+ FROM python:3.7.3
3+
4+ RUN apt-get clean; apt-get update; apt-get install cmake pkg-config libicu-dev zlib1g-dev libcurl4-openssl-dev libssl-dev ruby-dev vim -y
5+ RUN apt-get -y install git
6+
7+ RUN pip install nltk spacy
8+ # If I don't specify the download dir, they go to root and are unusable
9+ RUN python3 -c "import nltk; \
10+ nltk.download('punkt', download_dir='/usr/local/nltk_data/'); \
11+ nltk.download('averaged_perceptron_tagger', download_dir='/usr/local/nltk_data/'); \
12+ nltk.download('universal_tagset', download_dir='/usr/local/nltk_data/'); \
13+ nltk.download('stopwords', download_dir='/usr/local/nltk_data/'); \
14+ nltk.download('wordnet', download_dir='/usr/local/nltk_data/')" && \
15+ python3 -m spacy download en
16+
17+ RUN gem install github-linguist
18+
19+ # Copies your code to container
20+ COPY entrypoint.sh /entrypoint.sh
21+
22+ # Code file to execute when the container starts
23+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ # action.yaml
2+ name : ' HABITS Labeler'
3+ description : ' Add HABITS labels to repo PRs'
4+ inputs :
5+ gat : # id of input
6+ description : ' Github token that has access to habits'
7+ required : true
8+ owner :
9+ description : ' Owner of target repository'
10+ required : true
11+ name :
12+ description : ' Name of target repository'
13+ required : true
14+
15+ outputs :
16+ label : # id of output
17+ description : ' A label assigned for the current repo'
18+ runs :
19+ using : ' docker'
20+ image : ' Dockerfile'
21+ # Inputs are specified in main.yaml
22+ args :
23+ - ${{ inputs.owner }}
24+ - ${{ inputs.name }}
Original file line number Diff line number Diff line change 1+ #! /bin/sh -l
2+
3+ # TODO: Github secret censoring workaround
4+ echo $GITHUB_ACCESS_TOKEN | sed -e ' s/\(.\)/\1 /g' > token.txt
5+ NEW_TOKEN=` cat token.txt | sed -e ' s/ //g' `
6+ GITHUB_ACCESS_TOKEN=` cat token.txt | sed -e ' s/ //g' `
7+
8+ cd habits/habits-cli
9+ pip install --editable .
10+ cd ../../
11+
12+ # Initialize project folder
13+ habits --version
14+ habits init --folder collection
15+ cd collection
16+
17+ # Run pipeline on args (args assigned in action.yaml)
18+ # $1 - repo owner
19+ # $2 - repo name
20+ habits pipeline --mode " github_app" --owner $1 --repo $2
21+
22+ # Assign labels
23+ habits label --owner $1 --repo $2
Original file line number Diff line number Diff line change 1+ # Container image that runs your code
2+ FROM python:3.7.3
3+
4+ RUN apt-get clean; apt-get update; apt-get install cmake pkg-config libicu-dev zlib1g-dev libcurl4-openssl-dev libssl-dev ruby-dev vim -y
5+ RUN apt-get -y install git
6+
7+ # Dont need for pr remover
8+ # RUN pip install nltk spacy
9+ # # If I don't specify the download dir, they go to root and are unusable
10+ # RUN python3 -c "import nltk; \
11+ # nltk.download('punkt', download_dir='/usr/local/nltk_data/'); \
12+ # nltk.download('averaged_perceptron_tagger', download_dir='/usr/local/nltk_data/'); \
13+ # nltk.download('universal_tagset', download_dir='/usr/local/nltk_data/'); \
14+ # nltk.download('stopwords', download_dir='/usr/local/nltk_data/'); \
15+ # nltk.download('wordnet', download_dir='/usr/local/nltk_data/')" && \
16+ # python3 -m spacy download en
17+
18+
19+ # RUN gem install github-linguist
20+
21+ # Copies your code to container
22+ COPY entrypoint.sh /entrypoint.sh
23+
24+ # Code file to execute when the container starts
25+ ENTRYPOINT ["/entrypoint.sh" ]
Original file line number Diff line number Diff line change 1+ # action.yaml
2+ name : ' HABITS PR Label Remover'
3+ description : ' Remove labels from all PRs'
4+ inputs :
5+ gat : # id of input
6+ description : ' Github token that has access to habits'
7+ required : true
8+ owner :
9+ description : ' Owner of target repository'
10+ required : true
11+ name :
12+ description : ' Name of target repository'
13+ required : true
14+
15+ outputs :
16+ label : # id of output
17+ description : ' A label assigned for the current repo'
18+ runs :
19+ using : ' docker'
20+ image : ' Dockerfile'
21+ # Inputs are specified in main.yaml
22+ args :
23+ - ${{ inputs.owner }}
24+ - ${{ inputs.name }}
Original file line number Diff line number Diff line change 1+ #! /bin/sh -l
2+
3+ # TODO: Github secret censoring workaround
4+ echo $GITHUB_ACCESS_TOKEN | sed -e ' s/\(.\)/\1 /g' > token.txt
5+ NEW_TOKEN=` cat token.txt | sed -e ' s/ //g' `
6+ GITHUB_ACCESS_TOKEN=` cat token.txt | sed -e ' s/ //g' `
7+
8+ cd habits/habits-cli
9+ pip install --editable .
10+ cd ../../
11+
12+ # Initialize project folder
13+ habits --version
14+ habits init --folder collection
15+ cd collection
16+
17+ # Remove pr labels
18+ habits remove_pr_labels --owner $1 --repo $2
Original file line number Diff line number Diff line change 1+ on : [pull_request]
2+
3+ jobs :
4+ habits_action_job :
5+ runs-on : ubuntu-latest
6+ name : A job to run habits-cli labeler
7+ steps :
8+ # Step 1
9+ # To use this repository's private action,
10+ # you must check out the repository
11+ - name : Checkout test repository
12+ uses : actions/checkout@master
13+ # Step 2
14+ - name : Checkout habits repository
15+ uses : actions/checkout@v2
16+ # v1 checks out entire repo
17+ # v2 checks out only one commit
18+ with :
19+ repository : starlab-io/habits
20+ ref : enrich_graphql_updates
21+ token : ${{ secrets.HABITS_NEW }}
22+ path : habits
23+ # Step 3
24+ - name : Pipeline run step
25+ # Where the action is
26+ # format: {org}/{repo}[/path]@ref ?
27+ uses : ./.github/actions/habits_action
28+ id : pipeline
29+ with :
30+ owner : ' banjtheman'
31+ name : ' test'
32+ env :
33+ GITHUB_ACCESS_TOKEN : " ${{ secrets.HABITS_NEW }}"
34+ DO_RC : " ON"
35+ # GITHUB_ACCESS_TOKEN: " ${{ secrets.GITHUB_TOKEN }}"
Original file line number Diff line number Diff line change 1+ on : [workflow_dispatch]
2+
3+ jobs :
4+ habits_remove_labels :
5+ runs-on : ubuntu-latest
6+ name : A job to remove labels
7+ steps :
8+ # Step 1
9+ # To use this repository's private action,
10+ # you must check out the repository
11+ - name : Checkout test repository
12+ uses : actions/checkout@master
13+ # Step 2
14+ - name : Checkout habits repository
15+ uses : actions/checkout@v2
16+ # v1 checks out entire repo
17+ # v2 checks out only one commit
18+ with :
19+ repository : starlab-io/habits
20+ ref : enrich_graphql_updates
21+ token : ${{ secrets.HABITS_NEW }}
22+ path : habits
23+ # Step 3
24+ - name : Pipeline run step
25+ uses : ./.github/actions/habits_remove_pr_labels
26+ id : pipeline
27+ with :
28+ owner : ' banjtheman' # input your own org
29+ name : ' test' # input your own repo
30+ env :
31+ GITHUB_ACCESS_TOKEN : " ${{ secrets.HABITS_NEW }}"
32+ MY_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
You can’t perform that action at this time.
0 commit comments